which will sort with string comparison because of the use of cmp use <=> if you want numerical comparison, but note that the 'oid' field has a non-numerical value.my @sorted_keys = sort { $hash{$a}->{oid} cmp $hash{$b}->{oid} } keys +%hash;
-- #!/usr/bin/perl -w use strict;$;= ";Jtunsitr pa;ngo;t1h\$e;r. )p.e(r;ls ;h;a;c.k^e;rs ";$_=$;;do{$..=chop}while(chop);$_=$;;eval$.;
In reply to Re: sort hash by value
by Joost
in thread sort hash by value
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |