The $#$arrayref gets the index of the last element, and you subtract 2 from that to get the index of the third to last element (the last one you want). Update: Mis-read the OP as all except last 2 elements. Fixed.
In reply to Re: Trying to slice off all array elements but the last one
by Paladin
in thread Trying to slice off all array elements but the last one
by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |