Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I can't tell if this has been updated.

No. This is completely different code to my first attempt. I thought I had posted it, but it seems that I didn't.

This is the code in its final form:

#! perl -slw use strict; use List::Util qw[ reduce ]; use Data::Dump qw[ pp ]; sub canBeMadeFrom { my( $sigRef, $word ) = @_; for( split '', $word ) { return unless exists $sigRef->{ $_ }; delete $sigRef->{ $_ }; } return 1; } my %stats; while( <> ) { chomp; next if length() > 8; my $sig = join '', sort split '', $_; push @{ $stats{ $sig } }, $_; } print STDERR scalar keys %stats; my @eights = grep length() == 8, keys %stats; my %eights; @eights{ @eights } = delete @stats{ @eights }; print my $i = @eights; for my $eight ( keys %eights ) { printf STDERR "\r%5d '%s'\t", $i--, $eight; my %sig; undef @sig{ split '', $eight }; for my $lesser ( keys %stats ) { next unless canBeMadeFrom( { %sig }, $lesser ); for my $word ( @{ $stats{ $lesser } } ) { push @{ $eights{ $eight } }, $word if canBeMadeFrom( { %si +g }, $word ); } } } my @ordered = sort{ @{ $eights{ $b } } <=> @{ $eights{ $a } } } keys %eights; for( 0 .. $#ordered ) { print "$ordered[ $_ ]: ", scalar @{ $eights{ $ordered[ $_ ] } }; print "@{ $eights{ $ordered[ $_ ] } }"; }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^7: Challenge: 8 Letters, Most Words (top 50) by BrowserUk
in thread Challenge: 8 Letters, Most Words by Limbic~Region

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (5)
    As of 2014-07-23 04:04 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (133 votes), past polls