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


in reply to Re: Cutting the top percentage out of a Hash
in thread Cutting the top percentage out of a Hash

ikegami,
Alternatively, you could use Tie::IxHash instead of a hash. The syntax is the same (thanks to tie), but the contents are ordered.

It should be made clear that the order is the insertion order and not an arbitrary sort criteria. While the module does provide rudimentary sort capability, it is limited to asciibetical sorts of the keys or values.

Tie::Hash::Sorted may be a better fit.

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Cutting the top percentage out of a Hash
by Gavin (Archbishop) on Apr 13, 2006 at 19:07 UTC
    Thanks for the info
    I was hoping to avoid using Tie:: Hash
    a) Because I haven't used it before and I'm not sure of syntax.
    b) I was hoping for a more simple solution that would avoid installing the Tie:: Hash module
    Gavin
      a) There's a first time for everything
      b) Installing a module sometimes is the simple solution, and we have CPAN conveniently provided for us