in reply to Sorting a hash. What am I doing wrong?

what you are doing with this:
@uniq = sort {$seen{$a} <=> $seen{$b} } keys %seen;
is sorting the values stored in $seen{$a} against $seen{$b}, what you want is to sort the hash keys (not the hash values) then you want to just do something like the following:
@uniq = sort {$a <=> $b } keys %seen;

-enlil

Replies are listed 'Best First'.
Re: Re: Sorting a hash. What am I doing wrong?
by mndoci (Scribe) on Jan 14, 2003 at 00:42 UTC

    Duh

    And you are quite correct, of course.

    Thanks

    mndoci

    "What you do in this world is a matter of no consequence. The question is, what can you make people believe that you have done?"-Sherlock Holmes in 'A study in scarlet'