Okay, I have solved the frequency sorting by changing the prints to push. Then getting an array and joining the headers and allsentences. Then sorting by length.:

#5# .... push (@allsents, "MATCH #$count $sentmatches[$ +m]") unless $seens{ $sentmatches[$m] }++; $count++; } } push (@sepmatches, @allsents); ##$allmatches[0] is header, [1] is all sentences etc. +EVEN - header, ODD - sent ## Now join headers and sentences (0 and 1 etc.) foreach (@sepmatches) { ##Try Use natatime where n=2 $joinmatches = join ('', @sepmatches); } push (@allmatches, $joinmatches); @sortedallmatches = sort {length $b cmp length $a} @al +lmatches; } } } print @sortedallmatches; }

The messy part (though it's all pretty messy) is that I had to call the @allmatches after the first for loop so it would not print every result every time. Then call @sepmatches after the second for loop

Thanks for the help PM, I hope to join the ranks when I know a little more Perl!


In reply to Re: Search Engine Output needs sorting by Anonymous Monk
in thread Search Engine Output needs sorting by Anonymous Monk

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.