use strict; use warnings; use Sort::Fields; use Data::Dumper; my %hash = ( "bill nye" => "39||Somehere in Cali||Cali||12345", "homer simpson" => "36||Springfield||unknown||23456", "barney rubble" => "31||Bedrock||cartoon location||3456", ); my @sorted = map { /^([^\|]+)/ } fieldsort '||', [1, -1], map { $_ . '||' . $hash{$_} } keys %hash; print Dumper(\@sorted);
$VAR1 = [ 'barney rubble', 'bill nye', 'homer simpson' ];
In reply to Re: Complex hash sorting
by Roger
in thread Complex hash sorting
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |