[LA.pm] localtime (was: little help??)

Bob Mathews bobmath at sbcglobal.net
Thu Sep 29 16:20:34 PDT 2005


On Sep 29, 2005, at 3:26 PM, terry mcintyre wrote:
> I often use a similar method, but to avoid the warning messages about 
> unused variables, the following twist:
> # ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
> my (undef,undef,$hour) = localtime(time);

Is there an unused variable warning in perl? I've never seen one. The 
assign-to-undef trick is a good one to know, but I would like to 
suggest that it can be taken too far.
    my (undef, undef, undef, undef, undef, undef, undef, $yday) = 
localtime;
(Also, I think it only works in fairly recent perls.) Let's face it -- 
the localtime interface is garbage.

On Sep 29, 2005, at 4:03 PM, Peter Scott wrote:
> use Time::localtime;
> my $hour = localtime->hour;

Hear, hear.



More information about the Losangeles-pm mailing list