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

Re: [FWP] 4 Consecutive Letters



On Mon, 14 Aug 2000, Peter Scott wrote:

> At 10:10 PM 8/14/00 -0400, Rick Delaney wrote:
> >Don't forget the common golf trick of replacing ($1) with $&,
> >
> >     perl -ne'/.(??{++($b=++($a=$&));$a.$b.++$b})/&&print'
> >
> >though I can't say that that's properly defined, either.
> 
> That makes this the shortest so far, then:
> 
>        perl -ne'/.(??{($a=$&)++;$a++.$a++.$a})/&&print'

This will tie it:

    perl -ne'/((.)(?=(??{chr 1+ord$2}))){3}/&&print'

Unfortunately, this doesn't work:

    perl -ne'/((.)(?=(??{++($a=$2)}))){3}/&&print'

But this does:

    perl -ne'/((.)(?=(??{"".++($a=$2)}))){3}/&&print'

Anyone know why?

-- 
Neko


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