> > my $localtime;
> > @$localtime{qw / second minute hour mday month year weekday yearday isdst /
> } =
> > localtime(time);
> >
> > [1] A style nit:
>
> Speaking of nitpicks:
> my %localtime;
Assuming you are suggesting making that change, I'd reccomend against
it, unless you wish to elicit the following error:
Global symbol "$localtime" requires explicit package name at /tmp/try line 12.
Global symbol "$localtime" requires explicit package name at /tmp/try line 14.
Execution of /tmp/try aborted due to compilation errors.
However, leaving it as:
my $localtime;
@$localtime{qw / second minute hour mday month
year weekday yearday isdst /} = localtime(time);
print Dumper $localtime;
Will result in the following output:
$VAR1 = {
'weekday' => 5,
'hour' => 11,
'month' => 5,
'second' => 25,
'isdst' => 1,
'minute' => 27,
'yearday' => 160,
'mday' => 10,
'year' => 105
};
> > ##
> > ## MERELY BAD PERL
> > ##
> >
> > for my $index ( 0 .. $#person ) {
> > print "merely bad $person[$index]\n";
> > }
>
> This is not Bad Perl. This is a solution to a problem that the
> following code will not solve. Sometimes you need $index, sometimes
> you don't.
I concede the point -- it is not Bad Perl. It is Bad Programming, using
Perl as the platform for badness :)
The subtle point I was trying to make was: Needing $index is
frequently a sign of bad data design. Not always, mind you -- but it
should be a flashing yellow light meaning "am I doing something lame
here?"
>
> > ##
> > ## GETTING INTO THE PERL STATE OF MIND
> > ##
> >
> > for my $person (@person) {
> > print "Hello $person\n";
> > }
>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>