Change the date format from mmddyyyy to yyyymmdd

How do I change the date format from mmddyyyy to yyyymmdd in PERL.

Can any one help me please.

perl -wle '(undef,undef,undef,$mday,$mon,$year) = localtime(time);print $year+1900,$mon+1,$mday;'

;);):wink:

$ perl -le '$x="04262010"; $x =~ /(\d{2})(\d{2})(\d{4})/; print $3,$1,$2'
20100426

Thanks for the reply.... But how do I use the same in the script..?

when I use the same its not working.

$readabledate =~ '/(\d{2})(\d{2})(\d{4})/; print $3,$1,$2';

Please help