Hello AppleFritter,

Heap::Simple doesn't work for me, unfortunately: it requires either Heap::Simple::XS or Heap::Simple::Perl, and both fail their test suites.

Same here (Strawberry Perl v5.22.0 on Windows 8.1, 64-bit); but Heap::Priority installed fine and seems to do the same job:

#! perl use strict; use warnings; use Heap::Priority; printf "%6d %s\n", length($_), $_ for get_N_longest(10, 'wordsEn.txt' +); sub get_N_longest { my ($min, $infile) = @_; open my $infh, '<', $infile or die "Cannot open file '$infile' for reading: $!"; my $heap = Heap::Priority->new; $heap->highest_first; while (<$infh>) { chomp; $heap->add($_, length $_); } close $infh or die "Cannot close file '$infile': $!"; my @priorities = $heap->get_priority_levels; my @r; while (@r < $min) { my $priority = shift @priorities; push @r, $heap->get_level($priority); } return @r; }

Output:

22:35 >perl heap.pl 28 antidisestablishmentarianism 25 antidisestablishmentarian 23 disestablismentarianism 23 electroencephalographic 22 counterclassifications 22 counterrevolutionaries 22 electroencephalographs 22 electroencephalography 21 antienvironmentalists 21 antiinstitutionalists 21 counterclassification 21 electroencephalograms 21 electroencephalograph 21 electrotheraputically 21 gastroenterologically 21 internationalizations 21 mechanotheraputically 21 microminiaturizations 21 microradiographically 22:35 >

Hope this is of interest,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re^3: Size-limited, fitness-based lists by Athanasius
in thread Size-limited, fitness-based lists by AppleFritter

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.