in reply to Re^2: @array[1] is valid??
in thread @array[1] is valid??
#!/usr/bin/perl use strict; no warnings; my (@firstkey, @numberofkeys); my @list = qw /foo housekey blah carkey baz monkey/; @firstkey [0] = grep {/key$/} @list; $numberofkeys [0] = grep {/key$/} @list; print "@firstkey\n"; print "@numberofkeys\n"; __END__ housekey 3
And yes, there are a million different ways to write this code, but that's not the point.
But I can't think of a case where using @array [0] in non-lvalue context could return something else than $array [0].
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: @array[1] is valid??
by Aristotle (Chancellor) on Aug 05, 2003 at 15:51 UTC | |
by Abigail-II (Bishop) on Aug 05, 2003 at 16:12 UTC | |
by Aristotle (Chancellor) on Aug 05, 2003 at 16:47 UTC | |
by Abigail-II (Bishop) on Aug 05, 2003 at 21:18 UTC |