![]() |
|
Just another Perl shrine | |
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?? |
ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to sort an array, using "paid" listings first, and then "distance"... Here is what I've got to sort them by the distance: my @loop_sorted = sort { $a->{Distance} <=> $b->{Distance} } @test; An example of the @loop value would be: Basically I need to sort them using : isPaidLink (1 first, then 0 after) ... and then numberically via the "distance" field) I'm guessing this is possible, but I've never done it before so any pointers would be much appreciated :) TIA Andy
Back to
Seekers of Perl Wisdom
|
|