Front page | perl.golf |
Postings from January 2007
Re: simple golf for fun
Thread Previous
|
Thread Next
From:
Phil Carmody
Date:
January 17, 2007 01:47
Subject:
Re: simple golf for fun
Message ID:
504597.75407.qm@web25411.mail.ukl.yahoo.com
--- Ronald J Kimball <rjk-perl-golf@tamias.net> wrote:
> 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.
1//regexp/ would crash on the same thing that s/regexp// fails to blank.
So I thought that might be the intended (not space-saving) technique with
a rather bizarre unnecessary use of an unquoted literal to add confusion!
But a typo seems to make more sense.
The large-input behaviour remains a worry. So my modification of Ton's is
what I shall publish.
Phil
() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed
[stolen with permission from Daniel B. Cristofani]
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265
Thread Previous
|
Thread Next