Perlfunc: Zeropad

sub zeropad () {
   my ($num,$padding) = @_;
   $padding ||= 2;

   return sprintf("%0" . $padding . "d",$num);
}
Leave A Reply
All content licensed under the Creative Commons License