in reply to Slice Madness

Your hint just confused me a bit...

Context by itself doesn't explain the difference between $array[2..4] and $array[$x..$y], as both are on the same context (scalar). What matters is the sometimes-forgotten fact that the range operator in scalar context treats constants specially and compares them with the input line number ($.).

Replies are listed 'Best First'.
Re^2: Slice Madness
by japhy (Canon) on Nov 09, 2005 at 16:49 UTC
    Exactly.
    What I meant was that the values being displayed from the array are one level removed from what the '..' operator is actually doing. Printing scalar($x .. $y) vs. scalar(2 .. 4) is the key to seeing what's going on.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart