I\'ve been looking everywhere for an answer to this, and I just can\'t get it to work.
I have an input file that is read into an array using Perl. The file is a text
In your last code example you can replace
my @sorted = sort { $b->[4] <=> $a->[4] } @input;
with
my @sorted = sort { (split(' ', $b))[4] <=> (split(' ', $a))[4] } @input;
or even
my @sorted = sort { (split(/\s+/, $b))[4] <=> (split(/\s+/, $a))[4] } @input;
if input data has no lines with leading spaces.