develooper Front page | perl.golf | Postings from January 2007

Re: simple golf for fun

Thread Previous | Thread Next
From:
Phil Carmody
Date:
January 16, 2007 17:00
Subject:
Re: simple golf for fun
Message ID:
139073.32692.qm@web25410.mail.ukl.yahoo.com
--- 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.

Unfortunately it looks like it fails to even finish my 2400-line file - what's
its Big-Oh? :

$ time perl -n0 -e 'a//^((.*)(.*
)(?=\2.\3|$))*$/' < delsieve.log

<fx: kuolemanhiljaisuus />

Thanks for the interesting, and horribly short, contribution though.
Phil





()  ASCII ribbon campaign      ()    Hopeless ribbon campaign
/\    against HTML mail        /\  against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]


 
____________________________________________________________________________________
Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About