in reply to Re^2: Slicing an array variable with a -1 or any negative number doesn't work
in thread Slicing an array variable with a -1 or any negative number doesn't work

-1 or other -x (negative numbers) in slices, can only work with commas, but not with ..

Nope. The point is that ".." counts up. These work:

@letters = ('a'..'z'); say for @letters[-5..-1]; say for @letters[reverse(-1..0)];
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
  • Comment on Re^3: Slicing an array variable with a -1 or any negative number doesn't work
  • Download Code