Here's my two cents. Please consider the following:
you're comparing number to number (<=>), or text to text (cmp). It returns a -1, 0, or 1. Constructions like the one above are VERY common and work in the general case. You've made an assumption that @Notes is not being assigned to, but if the comparison operators are working, and the sort functions are working, and the assign-to operator is working, then the only thing left is to look at what's actually being compared.@Notes = sort { $b->{terms} <=> $a->{terms} } @Notes;
foreach my $l (@lines) { my $pns = PNSearch->new($MUH, $l->[0]-$cur, $l->[1], $file); push @Notes, $pns if ($pns); $cur = $l->[0]; } close($MUH); } use Data::Dumper; open DUMP, ">somefile.txt" or die $!; Dumper \@Notes; close DUMP;
Sincerely,
--marmotIn reply to Re^10: sort != sort
by furry_marmot
in thread sort != sort
by halfcountplus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |