Too much cheating?

#!/usr/bin/perl # http://perlmonks.org/?node_id=1201500 use strict; use warnings; my $file = '/usr/share/dict/words'; open my $fh, '<', $file or die "$! opening $file"; chomp( my @words = grep /^[a-z]{5,}$/, <$fh>); my @good = grep frequencysequence($_), @words; print "@good\n\n" . @good . "\n"; sub frequencysequence { for my $n ( 1 .. ((-1 + sqrt 1 + 8 * length) / 2) =~ s/^(\d+)\..*/$1 + + 1/er ) { "@_\n@_" =~ / (.).* \n (?: (?:(?!\1).)* \1 ){$n} (?:(?!\1).)* $ /x or return 0; } return 1; }

On my system outputs:

acacia allele assays banana baobab bedded bonobo bowwow cocoon deadhea +ded deemed doodad eddied eerier effete fesses heeded horror hubbub in +ning lessee lollop mammal manana messes needed papaya peeped peeper p +epped pepper pippin powwow reefer revere rococo salsas seeded senses +sereneness settee sleeveless tattoo teeter teethe wedded weeded xxvii +i xxxvii 49

In reply to Re^2: Puzzle Regex: Letter Frequency Arithmetic Sequence by tybalt89
in thread Puzzle Regex: Letter Frequency Arithmetic Sequence by QM

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.