Lawliet has asked for the wisdom of the Perl Monks concerning the following question:
As much as I hate being one of 'those' guys, I feel the code speaks for itself :P
#!/usr/bin/perl -w use strict; my ($sec, $min, $hour) = (localtime)[0..2]; print "$hour:$min:$sec\n"; ($sec, $min, $hour) = localtime[0..2]; print "$hour:$min:$sec\n"; __END__ 22:9:50 9:16:24
The former print statement displayed the correct time while the latter (obviously) did not. Why?
Update (30 min after initial post): Thanks for the explanations (and the pleonastic code correction).
I'm so adjective, I verb nouns!
chomp; # nom nom nom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (localtime) versus localtime - round 1
by ikegami (Patriarch) on Sep 28, 2008 at 02:38 UTC | |
by jwkrahn (Abbot) on Sep 28, 2008 at 05:35 UTC | |
by ikegami (Patriarch) on Sep 28, 2008 at 06:58 UTC | |
by jwkrahn (Abbot) on Sep 28, 2008 at 07:04 UTC | |
by ikegami (Patriarch) on Sep 28, 2008 at 07:48 UTC | |
|
Re: (localtime) versus localtime - round 1
by jwkrahn (Abbot) on Sep 28, 2008 at 02:43 UTC | |
|
Re: [Updated] (localtime) versus localtime - round 1
by Fletch (Bishop) on Sep 28, 2008 at 05:59 UTC |