Here is the script
use strict;
sub sortF {
my $l1 = hex ${@$a}[0];
my $l2 = hex ${@$b}[0];
return $l1 <=> $l2;
}
my @results;
my @parsedLine = ['0x1a',"hello"];
push(@results, @parsedLine);
my @parsedLine2 = ['0x1b',"ohello"];
push(@results, @parsedLine2);
my @sortedresults = sort(sortF(@results));
I want to sort the list @results by the first element of the anonymous array pointed to by the list elements
This give the error
Can't use string ("0") as an ARRAY ref while "strict refs" in use at ...
How should the sortF function be written?
You make a number of small mistakes in your use of references, you should take a look at perlref and perlsort for details of what to do: