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

Re: simple golf for fun

Thread Previous | Thread Next
From:
Yanick Champoux
Date:
January 16, 2007 09:14
Subject:
Re: simple golf for fun
Message ID:
12937.209.202.115.133.1168969442.squirrel@209.202.115.133
Phil Carmody said:
> This is a real world task which can be solved in a couple of lines.
> Which makes me think that you guys can do it in about half a line!

   Not exactly half a line, but still not too bad:

#!perl -lp
$p=~s/\B|\b/(.)?/g;/^$p$/;
$p=$_;$_=(@m=grep/./,@-)==2?pop@m:die"broken sequence";


Joy,
`/anick






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