Pradeep Sethi wrote: > but it should work in case of 09/09/1973 also ? How about this? (golfers, please don't laugh at me;-):
my $x = '9/8/1973'; my ($d, $m, $y) = $x =~ m!(\d\d?)/(\d\d?)/(\d+)! or die "invalid date\n"; my $z = sprintf("%.2d/%.2d/%d", $d, $m, $y); print "$z\n"; /-\ndrew