Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Puzzle Regex: Letter Frequency Arithmetic Sequence

by tybalt89 (Monsignor)
on Oct 17, 2017 at 18:22 UTC ( [id://1201524]=note: print w/replies, xml ) Need Help??


in reply to Re: Puzzle Regex: Letter Frequency Arithmetic Sequence
in thread Puzzle Regex: Letter Frequency Arithmetic Sequence

"counting frequencies means hashes" - not always :)

#!/usr/bin/perl # http://perlmonks.org/?node_id=1201500 use strict; use warnings; my $file = '/usr/share/dict/words'; # YMMV open my $fh, '<', $file or die "$! opening $file"; while(<$fh>) { /^[a-z]{6,}$/i or next; my $word = $_; my @counts; $counts[ s/$&//gi ] .= $& while s/.//; grep(!$_ || /../, @counts) or print $word; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1201524]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-20 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found