[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] gmtime format in array variable



On Thu, Dec 07, 2000 at 03:45:56PM -0500, Mike Hyslop wrote:
> #print out filename to copy on screen
> use Time::gmtime;
> $tm = gmtime;
> printf("The current file to copy is m%03d%02d%02d.gz\n", 
> ($tm->year+1900, $tm->mon)+1,  $tm->mday, $tm->hour-1);

Your parentheses are oddly placed there...


> Am I totally off track in my approach here, or is there a way to 
> format the contents of the @ftc variable to include the zeroes I 
> need?  (I also suspect if I were writing this script in January 
> instead of December my month values would be missing the zero I 
> need... I'll adjust my system time to check this).

Use sprintf, just like you used printf in the other snippets.


Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org