in reply to How to get 2nd highest value from an array?

If the list (or hash) is large, first doing a `sort` is a Really Bad Idea^{TM} given that this is an O(*n* log *n*) operation. As choedebeck's code above illustates it can be done in time linear in the size of the list/hash, i.e., O(*n*). This is a significant difference for large values of *n*.

Hope this helps, -gjb-

In Section
Seekers of Perl Wisdom