my @data = ( { name => 'john', score => '70' }, { name => 'peter', score => '90' }, { name => 'dan', score => '50' }, ); my @new = sort { $a->{score} <=> $b->{score} } @data; print "$_->{'name'}\t$_->{'score'}\n" for (@new);
regards,
Franklin
Don't put off till tomorrow, what you can do today.
In reply to Re: Sorting array of hash references
by l.frankline
in thread Sorting array of hash references
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |