http://www.perlmonks.org?node_id=1204548


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

The syntax for an array slice is @NAME[LIST], not @NAME[NUM..NUM]. What that means is that .. is just an ordinary range operator in this scenario.

The range operator (in list context) returns an ascending sequence of numbers starting with its LHS operand and ending with its RHS operand. For example, 0..3 produces the foud scalars 0, 1, 2 and 3, while 0..-1 doesn't produce anything.

Replace

@$row[0..-1]

with

@$row[0..@$row-1]

or

@$row[0..$#$row]

or just

@$row