http://qs321.pair.com?node_id=1129266


in reply to Getting first and last element value of a hash loop

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.

Replies are listed 'Best First'.
Re^2: Getting first and last element value of a hash loop
by parv (Parson) on Jun 05, 2015 at 22:06 UTC