in reply to Is this a bug, or expected behavior?

To get a slice, you need to use the @ sigil on an array, and the subscript is evaluated in list context. Case $c is the correct way to do this.

Case $b doesn't parse as a slice, but a single element dereference owing to the arrow. This forces scalar context on the subscript expression, turning your .. range operator into a flipflop operator, returning false (which is 0 in numeric context), hence the first element of @$a. In certain circumstances depending on the surrounding code, it could give you the second element, i.e. 'had'.

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

  • Comment on Re: Is this a bug, or expected behavior?