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

Re: [FWP] Puzzle thread on clpmod



At 01:21 PM 7/7/99 -0400, Ronald J Kimball wrote:
>On Wed, Jul 07, 1999 at 12:51:00PM -0400, Chaim Frenkel wrote:
> > >>>>> "JP" == John Porter <jdporter@min.net> writes:
> >
> > JP>     while ( /[a-e](?=[a-e]{4})/g ) {
> > JP>       join( '', sort split //, substr( $_, pos()-1, 5 ) ) eq 
> 'abcde' or next;
> >
> > You need an lc in there, some words are capitalized.
>
>Not in my wordlist.  :)
>
>
> > How about the slightly shorter (join '', sort split //, lc) =~ /^abcde/
>
>Shorter but incorrect (see clpmod).  It does not work properly with
>duplicate letters, and it does not require the 5 letters to be consecutive.

Well the consecutive nature is handled by the sort (which will arrange them 
into consecutive order if they're there), so you could try:

(join '', sort split //, lc) =~ /^a+b+c+d+e+/

to account for potential dupes....

Couldn't you? Or did I miss something...

D

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