in reply to File Sorting
Could you please read the Site How To and post at least one decently formatted question please? Thanks!
Frankly speaking, your descending order based on z seems a quite random order: I really can't see which sorting algorithm you used to obtain x y z xyz 2 8 5 abc 1 4 3 from x y z abc 1 4 3 xyz 2 8 5
This quick-and-dirty (and ***untested***) snippet does a standard reverse sort: you can take it and adapt it for your needs.
use strict ; use warnings ; my $tempfile = "temp_file_name.txt" ; my $outfile = "/path/to/values" ; open IN, $tempfile or die $! ; open OUT, $outfile or die $! ; while (<IN>) { chomp ; my ($name,@values) = split ; print OUT join(" ",$name,reverse sort @values),"\n" ; } close OUT ; close IN ;
Ciao!
--bronto
# Another Perl edition of a song:
# The End, by The Beatles
END {
$you->take($love) eq $you->made($love) ;
}
|
|---|