Timothy wrote:
>"padnum" is a routine I created to put in initial zeroes. (Yes, I'm sure that there
>is a more efficient way to do it.)
>
>sub padnum {
> # pad number with initial zeroes if less than specified digits (default 2)
> my ($num,$digits) = @_;
> $num += 0;
> if ( $digits == 0 ) { $digits = 2; }
>
> while ( length($num) < $digits ) { $num = "0$num"; }
> return ( $num );
>} # padnum
This gives warnings if you run it with #!perl -w, which you should of course :)
I would rewrite it as:
sub padnum {
my( $num, $digits ) = @_;
$num += 0;
if( ! defined $digits or $digits < 0 ) { $digits = 2 }
$num = sprintf "%0${digits}d", $num;
}
But why not work straight:
...
my ($mday,$mon,$year) = (localtime($info->ioFlCrDat))[3..5];
sprintf "%4d/%02d/%02d", $year+1900, $mon+1, $mday;
# $year+=1900; $mon=padnum($mon+1); $mday=padnum($mday);
# return "$year/$mon/$mday";
...
Best wishes,
Axel.