in reply to Accessing multiple array index
A key to understanding Perl is that the sigils ($, @, %, ...) tell you the type of the thing that an expression returns. $route[1..10] returns a scalar value. @route[1..10] returns a list.
The $route[1..10] case is particularly interesting because with strictures (you do always use warnings and strict, use strict; use warnings;, don't you?) you get a message like:
Use of uninitialized value $. in range (or flip) at ...
See Flipin good, or a total flop? for why that is.
|
|---|