Front page | perl.golf |
Postings from January 2007
Re: simple golf for fun
Thread Previous
|
Thread Next
From:
Ronald J Kimball
Date:
January 16, 2007 19:09
Subject:
Re: simple golf for fun
Message ID:
20070117030859.GA65917@penkwe.pair.com
On Tue, Jan 16, 2007 at 04:59:51PM -0800, Phil Carmody wrote:
> --- Juho Snellman <jsnell@iki.fi> wrote:
> > Phil Carmody <thefatphil@yahoo.co.uk> writes:
> > > -p0 s/^((.*)(.*)
> > > (?=\2.\3
> > > |$))*$//
> >
> > Assuming the last line is also newline-terminated:
>
> Fair assumption
>
> > -n0 a//^((.*)(.*
> > )(?=\2.\3|$))*$/
>
> Kiitos, Juho.
>
> That's gone beyond my perl ken! Was this the expected failure outcome?
>
> $ echo -e "1\n12\n173\n" | perl -n0 -e 'a//^((.*)(.*
> )(?=\2.\3|$))*$/'
> Illegal division by zero at -e line 1, <> chunk 1.
I believe that should be -p0 s/...//, rather than -n0 a//.../. It's the
same as yours, except with the newline matched as part of \3 to save a
character.
Ronald
Thread Previous
|
Thread Next