http://qs321.pair.com?node_id=401260


in reply to How can I format the output of localtime?

This is an update of Roy Johnson's great answer, for those who just want the current time formatted in m/d/y.
my ($d,$m,$y) = (localtime)[3,4,5]; my $mdy = sprintf '%d/%d/%d', $m+1, $d, $y+1900;
Or if month and day should always be two digits:
my $mdy = sprintf '%02d/%02d/%04d', $m+1, $d, $y+1900;