in reply to Sort not acting as expected on Hash Ref

Do you know what scalar %{$foo->{1}} gets you if $foo = { 1 => { 6,7 } , 2 => { 66,77 } };?

I believe you simply want compare

$foo->{$b} <=> $foo->{$a}


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re: Re: Sort not acting as expected on Hash Ref
by pg (Canon) on Jan 01, 2003 at 17:44 UTC
    In a scalar context, hash would be evaluated to a fraction, which represents "number of buckets used" out of "number of buckets allocated". So it would be some kind of order related to memory usage.

    However what we got is a string representation of a fraction, so the order is not quite right, for example 13/16 would be less than 2/16.