Hello,
I'm still new at Perl and I'm trying to understand how to effectively implement the Schwartzian Transform on a data file. Here's what I'm trying to do
which, as discussed on a previous thread, is an implementation of the Schwartzian Transform. The way I understand it, the file is opened and read into an array, then the array is sorted by the fourth field which is stored then printed. I've been tinkering with the values a bit, but it's still not sorting the way I'd hoped. Am I doing something wrong?
Thanks in advance
I'm still new at Perl and I'm trying to understand how to effectively implement the Schwartzian Transform on a data file. Here's what I'm trying to do
Code:
my $test_file = "../data/data_file";
open TEST, "<$test_file";
my @test_sort = <TEST>;
close TEST;
my @arr = map {$_->[1]}
sort {$b->[0] <=> $a->[0]}
map {[ (split)[3], $_ ]}
@test_sort;
print for @arr;
Thanks in advance