[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Puzzle thread on clpmod




RJK wrote:
> On Tue, Jul 06, 1999 at 04:26:37PM -0700, tushar@i-works.com wrote:
> > 
> > Could someone figure out what they are?
> 
> Counting variations, I have 26 words which fit (including those from the
> original puzzle).

Wow.  My system's dictionary file (Solaris 2.6 /usr/share/lib/dict/words)
contains only two, a 7-letter and an 8-letter.

Here's my perl solution:

  open F, "< /usr/share/lib/dict/words" or die "open words file: $!\n";
  while (<F>) {
    chomp;
    while ( /[a-e](?=[a-e]{4})/g ) {
      join( '', sort split //, substr( $_, pos()-1, 5 ) ) eq 'abcde' or next;
      print "$_\n";
      last;
    }
  }
  close F;

John Porter


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe