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

Re: [MacPerl] Time question



On Thu, Jan 06, 2000 at 11:37:19AM -0800, Enrique Terrazas wrote:
> Your script can be written a little more succinctly (and I think a little
> more readable):
> 
>     #!perl -w
>     use strict;
>     my ($mday, $mon, $year) = (localtime(time))[3..5];
>     $year = $year + 1900;
>     $year = substr $year, 2;

Those two lines may be replaced with:

$year %= 100;

>     print sprintf "\n%02u/%02u/%02u", $mon + 1, $mday, $year;

print sprintf is redundant; use printf instead.

Ronald

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