--- Ronald J Kimball <[EMAIL PROTECTED]> wrote:
> On Tue, Jan 16, 2007 at 04:59:51PM -0800, Phil Carmody wrote:
> > --- Juho Snellman <[EMAIL PROTECTED]> wrote:
> > > Phil Carmody <[EMAIL PROTECTED]> 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 

Reply via email to