eye has asked for the wisdom of the Perl Monks concerning the following question:
In the following code snippet, I don't understand why Perl 5.8.8 says there is a syntax error near ")[" at #3.
#!/usr/bin/perl use strict; use warnings; my $t = (time)[0]; #1 my @t = localtime $t; @t = localtime ((time)[0]); #2 @t = localtime (time)[0]; #3
If I comment out #3, both #1 & #2 correctly populate @t. It just seems as though the outer parentheses in #2 should not be needed.
Thanks,
eye
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Parenthetical help
by Corion (Patriarch) on Apr 03, 2011 at 15:00 UTC | |
by eye (Chaplain) on Apr 04, 2011 at 04:12 UTC | |
Re: Parenthetical help
by jwkrahn (Abbot) on Apr 03, 2011 at 17:55 UTC | |
by eye (Chaplain) on Apr 04, 2011 at 04:59 UTC | |
by jwkrahn (Abbot) on Apr 04, 2011 at 19:35 UTC | |
Re: Parenthetical help
by wind (Priest) on Apr 03, 2011 at 18:37 UTC |