Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Sorting an array using multiple values?

by ultranerds (Hermit)
on Sep 08, 2011 at 16:53 UTC ( #924872=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @test;
    push @test, { distance => "0.12", name => "Test1", isPaidLink => 0 };
    push @test, { distance => "1.2", name => "Test1", isPaidLink => 1 };
    ...
    push @test, { distance => "9.2", name => "Test1", isPaidLink => 0 };
    push @test, { distance => "14", name => "Test1", isPaidLink => 1 };
    my @loop_sorted = sort { $a->{Distance} <=> $b->{Distance} } @test;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://924872]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2023-12-04 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (25 votes). Check out past polls.

    Notices?