[LA.pm] Spam:***, Re: little help??

Peter Scott Peter at PSDT.com
Thu Sep 29 16:03:19 PDT 2005


use Time::localtime;
my $hour = localtime->hour;

At 03:26 PM 9/29/2005, 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);
>
>--- Peter Benjamin <pete at peterbenjamin.com> wrote:
>
> > At 08:00 PM 9/28/2005, Mike Dillon wrote:
> > >> my $hour = (split, localtime)[2];
> >
> > I've read a lot of code that uses perl shortcuts.
> > It's obtuse.  Not a new argument regarding perl.
> > my
> >
>($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
> > = localtime(time);
> >
> > is a copy and paste from
> > Perl/html/lib/Pod/perlfunc.html#item_localtime
> > and I just use it, over and over, rather than try to
> > recall what
> > subscript is the hour.
> >
> > When more than just the hour is needed, I know
> > exactly what variables to use.
> >
> > Yes, do read shortcut code, and understand that
> > shortcut is there
> > and how the shortcut works for it's scope and
> > context, as that
> > can lead to very advance use of perl, and in one
> > line do something
> > that would otherwise take 10 lines.  But when first
> > starting to use
> > perl... I advise to learn the easy way, where the
> > perl Help copy
> > and paste method is quite clear, and debugging is
> > non-existent,
> > resulting in faster time to working code, and moving
> > on to the
> > next perl project.

-- 
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
http://www.perlmedic.com/



More information about the Losangeles-pm mailing list