"M. Lewis" schreef: > if I were to want $day, $month, $hour, > $minute & $sec to have a leading zero (ie 01 for Jan rather than 1), > is my only option to use printf? Or is there a better way. > > What I'm searching for here is the *correct* method to get $day, > $month, etc for uses like naming backup files > (databackup-2007-01-21.tar.gz).
(s)printf is fine: my $i = 0; my $fname = sprintf "databackup-%04d-%02d-%02d.tar.gz", map {$_ + (1900,1,0)[$i++]} (localtime)[5,4,3]; -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/