in reply to sort hash keys as numbers and maybe even more...

In Perl 5, hash keys are strings. Numbers, references, undef and globs are stringified when used as a hash key. Tie::RefHash solves some problems.

This all has nothing to do with how hash keys are sorted. sort doesn't care or even know the list you give it is a list of hash keys. It sorts the same way it always does: using the code you supply or { $a cmp $b } if you didn't define a method of sorting.

Juerd
- http://juerd.nl/
- spamcollector_perlmonks@juerd.nl (do not use).

  • Comment on Re: sort hash keys as numbers and maybe even more...