Or, simply use -1 to get the last element: $array[-1]. See perldata: Subscripts.
In reply to Re^2: Getting first and last element value of a hash loop
by parv
in thread Getting first and last element value of a hash loop
by techworkpc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |