in reply to Slicing an array variable with a -1 or any negative number doesn't work

Since -1 is less than zero the range operator [0..-1] doesn't give anything. You'll have to extract the value yourself. eg: @$row[0..$#$row]

Replies are listed 'Best First'.
Re^2: Slicing an array variable with a -1 or any negative number doesn't work
by Anonymous Monk on Nov 29, 2017 at 18:20 UTC
    FWIW, slicing in Python works the way the OP seems to expect. One of the few times where Perl makes more sense than Python IMO.

      Then you'll be disappointed to learn about substr($s, 0, -1) and slice(@a, 0, -1)

        You mean splice(@a, 0, -1)? What makes you think I don't know about it?