Frustrating Perlism

Ouch.

I just spent longer than I wanted to learning how to slice an arrayref.

So, if you slice a normal array like this: @array[$begin..$end], you might want to slice an arrayref like this: $arrayref->[$begin..$end]. But that doesn't work.

You have to slice the transformed ref: @{$arrayref}[$begin..$end].

...Now we know.

No comments: