Re: simple golf for fun
Ronald J Kimball <[email protected]> Tue, 16 Jan 2007 22:08:59 -0500
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
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. Ronald