in reply to sorting a hash by key

The default collating sequence for sort is ASCII (cmp). If you want something different, you have to tell sort how to compare two items.

foreach $number (sort {$a <=> $b} (keys(%name))) {

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Replies are listed 'Best First'.
Re^2: sorting a hash by key
by Anonymous Monk on Aug 04, 2005 at 15:21 UTC
    thanks for ur help. quite new to hashes, proving very useful little things