I’m running the following code and I’m attempting to print the first element in the @rainbow array through the fifth-from-last element in the @rainbow array. This code works for any positive indices within the bounds of the array, but not for negative ones:
@rainbow = ("a".."z");
@slice = @rainbow[1..-5];
print "@slice\n";
You want
Be careful, 1 is the second element, not the first.