my ($day,$month) = (5,6); for ($day,$month){ $_ = sprintf('%2.2d',$_); # Adds Leading zero if necessary }