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

Re: [FWP] 4 Consecutive Letters



On Mon, Aug 14, 2000 at 12:00:09PM -0700, Peter Scott wrote:
> At 11:17 AM 8/14/00 -0700, I wrote:
> >       perl -ne'/(.)(??{join"",map chr ord($1)+$_,1..3})/&&print'
> 
>           perl -ne'/(.)(??{$a=$b=$1;$b++;++$a.++$b.++$b})/&&print'

Taking advantage of the fact that assignment returns an lvalue, we can
save a stroke:

            perl -ne'/(.)(??{++($b=$a=$1);++$a.++$b.++$b})/&&print'

But since ++$b.++$b isn't properly defined, AFAIK, we could use:

            perl -ne'/(.)(??{++($b=++($a=$1));$a.$b.++$b})/&&print'


Abigail

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