in reply to array element return syntax
Close. You need parens around the list expression being indexed.
You can also extract multiple elements:$hour = (localtime(time))[ 2 ];
my ($y, $m, $d) = (localtime(time))[ 5, 4, 3 ];
This feature is called a "list slice", and it's documented in perldata.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: array element return syntax
by Lyndley (Novice) on Mar 29, 2006 at 15:42 UTC | |
by davorg (Chancellor) on Mar 29, 2006 at 15:50 UTC | |
by ikegami (Patriarch) on Mar 29, 2006 at 15:46 UTC |