Is there a short-cut way in perl to slice an array with the range (..)
operator?

I am trying to get a slice of an array from the second element to the
second to last element.  This would be equivalent to a shift and a pop,
except that I do not want to modify the array itself.  This is the closest
I've come up with so far:
  perl -e '@f=(1..10); print @f[1..$#{@f}-1], "\n"; '

I'd like to be able to do something like this:
  perl -e '@f=(1..10); print @f[1..-2], "\n"; '

but this doesn't work.

Regards,
- Robert


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to