in reply to @array[1] is valid??
"Saying @foo[1] when you mean $foo[1]. The @foo[1] reference is an array slice, meaning an array consisting of the single element $foo[1]. Sometimes this doesn't make any difference, as in:
but it makes a big difference for things like:print "the answer is @foo[1]\n";
which will slurp up all the rest of STDIN, assign the first line to @foo[1], and discard everything else. This is probably not what you intended. Get into the habit of thinking that $ means a single value, while @ means a list of values, and you'll do okay."@foo[1] = <STDIN>;
--
Allolex
|
|---|