> Fellow Perl lovers,
>
> I'm trying to zero fill a numeric variable (which
> in this case happens to be the current month and
> day).
Does this sound familiar or what?
> The sprintf (%02d) function would seem a likely
> candidate for this, but I don't actually want to
> print the value. It's being used as part of a
> filename.
sprintf is the non-printing version of printf - and
is exactly what you want.
> ....
> my $month = length((localtime)[4] + 1) == 1 ? '0' .
> ((localtime)[4] + 1) : (localtime)[4] + 1;
> my $day = length((localtime)[3]) != 1 ? (localtime)[3] :
> '0' . (localtime)[3];
> my $monthday = $month . $day;
> my $output_file = join ('_', 'resend' , $monthday ,
> "$key");
> ....
>
> Is there a more elegant way of doing this?
Obviously! Code like that gets sent to /dev/bucket
Take care,
Jonathan Paton
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]