On Thu, Jan 31, 2002 at 05:17:17PM -0800, Pradeep Sethi wrote:
> Hi All,
>
> I want to change date 9/9/1987 to 09/09/1973
>
> was wondering, what is the most efficient way ?
Probably not:
$_ = '9/9/1987';
$"="";$_=
"@{[(m|(\d)|g)[qw]
3 0 2 1 5 ]],$+-4]}";
s| .|0$&/|x ;
s|(?<=\D).|0$&/|x ;
print;
but, hey, the most efficient solution is probably
not as pretty anyway. ;)
Seriously (well, kind of), why not:
$_ = join '/', map { sprintf "%02d", $_ } split '/', $_;
Joy,
`/anick
--
$_= "e nte elhce.rka rPrhoatY"; @nothing = ( '', '' );
s#(.)(.*)(.)#$2#g and ($\,$,)=($1,$3) and print @nothing
while $_;