We don't bite newbies here... much | |
PerlMonks |
Re: date +%Y%m%dby arturo (Vicar) |
on Aug 21, 2001 at 17:29 UTC ( [id://106554]=note: print w/replies, xml ) | Need Help?? |
There are a few ways to do this in perl. It's a good day to learn about array slices and s/printf.
The "%02d" formatting string (roughly: give me two digits, add enough '0's to the front to make the field two wide) is highly useful for 0-padding things to a specified length (in this case, 2). Overall, it's more typing than the external call to date? Sure, but it's more portable and (although I haven't benchmarked it), more efficient (doesn't spawn a subshell). HTH.
In Section
Seekers of Perl Wisdom
|
|