[plug] [Perl] sorign arrays based on scalar value
Patrick Tehvand
patrick at perthix.net
Fri Nov 15 11:16:21 WST 2002
'ello all,
I sent this to the SLPWA list by mistake...
I've got another perl question,
I would like to sort in decending nemerical order based on $id
This is what I have.
sub resort() {
#Sort everthing out into numerical order
my @final;
my $inputfile=$_[0];
open (THING,"<$inputfile");
my @sortinput=<THING>;
close THING;
for $input(@sortinput) {
chop ($input);
($id,$title,$words)=split(/\|/,$input);
@final = ____some sorting stuff___
open (RESORT,">$inputfile");
for $line(@final) {
print RESORT "$line";
}
close RESORT;
return 0;
}
}
Cheers
Patrick
_____________________________________________________________________
This e-mail is brought to you 100% virus free by Perth iX using MessageLabs SkyScan scanning service. For more information please call Perth iX on +61 8 92166600 or email info at perthix.net.
More information about the plug
mailing list