ocs has asked for the wisdom of the Perl Monks concerning the following question:
I want to sort this thing after string1. I tried this one:$hash = { 1 => { key1 => string1, key2 => string2 }, 2 => { key1 => string3, key2 => string4 } }
I doesn't work :(foreach my $key (sort { $hash->{'key1'} {$a} cmp $hash->{'key1'} {$b} +} keys %$hash) { ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort hash after value from hash in hash
by davorg (Chancellor) on Nov 24, 2006 at 14:46 UTC | |
by ocs (Monk) on Nov 24, 2006 at 14:53 UTC | |
|
Re: sort hash after value from hash in hash
by rhesa (Vicar) on Nov 24, 2006 at 14:50 UTC | |
by ocs (Monk) on Nov 24, 2006 at 16:39 UTC | |
|
Re: sort hash after value from hash in hash
by shmem (Chancellor) on Nov 24, 2006 at 14:50 UTC | |
by ocs (Monk) on Nov 24, 2006 at 14:56 UTC | |
by shmem (Chancellor) on Nov 24, 2006 at 15:00 UTC | |
by ocs (Monk) on Nov 24, 2006 at 15:09 UTC | |
by Hofmator (Curate) on Nov 24, 2006 at 15:13 UTC | |
|