Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
Of course this won't work. Silly me.
my $line_no = 1;
@expected_data =
sort {
$a->[1] <=> $b->[1]
||
Foo::compare($a->[5], $b->[5])
||
$a->[2] <=> $b->[2]
}
map { unshift @$_ => $line_no++ }
@expected_data;
sort isn't working on a list of array refs (Score:1)
I think I see a couple of problems, but I'd need to see the whole code to get it.
map generates a simple list, but the sort code appears to be working on a list of array reference. It looks like you were trying to build a hash with map. However, the sort code thinks that each element of the list is an array reference. The "keys" of the "hash" may be array refs (which would be super weird), but the "values" certainly are not.
This is very functional (that is lisp-like) code. Perhaps you might consider tu
Re:sort isn't working on a list of array refs (Score:2)
This illustrates the problem:
That will print "123". The return value of unshift is the number of elements in the array after unshifting.