halfcountplus,

Here's my two cents. Please consider the following:

  1. The various sort functions are well-known and I doubt the built-in sort has a new bug.

  2. Even if the built-in sort is somehow broken, you said you used a couple of other sorts, as well, and I doubt they all broke at once.

  3. When you feed sort a block, as below,
    @Notes = sort { $b->{terms} <=> $a->{terms} } @Notes;
    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.

  4. Which, I hasten to point out, is the one thing we haven't seen yet except as a small excerpt of dumped hashes. We can't duplicate all your code because we don't have all your modules or your databases, and all you are showing us is your code and part of your databases. Please use Data::Dumper or YAML or whatever you like and Dump the the actual structure of @Notes and post at least a subset. Maybe here:
    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;
  5. No one has called you a liar, and it doesn't have to be a bug in your code (which you said you updated, by the by!!!), but obviously something isn't working and that's why people keep asking to see what's actually in @Notes, rather than hear your assurances about it.

Sincerely,

--marmot

In reply to Re^10: sort != sort by furry_marmot
in thread sort != sort by halfcountplus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.