Ranking Items... Help!
Okay, so I have this file and each lines contains variables separated by | :
open(DATA, "$data_path\\$FORM{'id'}\\affiliates.txt");
if ($flock eq "y") {
flock DATA, 2;
}
@data = <DATA>;
chomp @data;
close(DATA);
foreach $line (@data) {
($name, $variable1, $variable2, $date) = split(/\|/, $line);
$variable1 is a number. My question is how do I sort the items from greatest to least based on $variable1?? Thanks in advance!
Peter J. Boettcher posted this at 19:08 — 30th December 2001.
They have: 812 posts
Joined: Feb 2000
I'm not a Perl expert but maybe this link can give you some ideas: http://www.perl.com/pub/a/2000/12/begperl4.html#sorting
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.