in reply to sub-sorting a hash

I'd say to see Sort::Key, but I find it a little unclear. To roll your own, do something like this:
my @sort_keys = qw(director title id type); use List::Util 'first'; sort { first {$a->{$_} cmp $b->{$_}} @sort_keys } @recs;

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: sub-sorting a hash
by salva (Canon) on Apr 26, 2006 at 15:58 UTC
    use Sort::Key::Multi 's4_keysort'; # s4 => 4 string keys @sorted = s4_keysort { @{$_}{qw(director title id type)} } @recs;