Since a list starts at element 0, the index of the last element in the list is one less than the total number of elements. For instance, if the array @arr contains 5 elements, $arr[4] is the last. Try using [$count-1] as the index to get the last item in your sorted list.
Update: parv's answer is better than mine, see below.
Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.
In reply to Re: Getting first and last element value of a hash loop
by aaron_baugher
in thread Getting first and last element value of a hash loop
by techworkpc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |