in reply to Re^2: Sorting a Hash Ref
in thread Sorting a Hash Ref

That string, "57e27be8194bb2332a49a942e7aeafeb", is your key (as shown in your original post.) You are trying to use the key itself as a hash ref. You can't do that. You need to look up the hash ref stored in your hash at that key. I.e. you are doing something like $key->{old_file} where you need to be doing something like $yourhash{$key}->{old_file} or possibly $yourhashref->{$key}{old_file}. It's impossible to tell which from your post because you don't show us whether you access your top level hash directly or through a reference.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^4: Sorting a Hash Ref
by bkiahg (Pilgrim) on Oct 26, 2005 at 20:28 UTC
    I guess my understanding of sort leaves much to be desired. Here is the code I am using to build the hash. This below doesn't error but it is not carrying the rest of the data attached with it.
    my %sorted = sort { $patients->{$a}{old_file} cmp $patients->{$b}{old_file} } (keys %{$patients}); my $patients = \%sorted; # or put { } around the sort expression to do it one line.
    or
    sort { $$patients{$a}->{old_file} cmp $$patients{$b}->{old_file} }
    And for some odd reason $patients is no longer a hash ref??