Front page | perl.golf |
Postings from August 2002
Re: Reflections
Thread Previous
|
Thread Next
From:
Juho Snellman
Date:
August 8, 2002 01:11
Subject:
Re: Reflections
Message ID:
20020808081033.GA24481@iki.fi
On Thu, Aug 08, 2002 at 08:31:44AM +0100, Stephen Turner wrote:
> So, the empty regexp lets $` escape. How did you discover
> that? Was it a brilliant insight, did you already know it, or was it (more
> likely, in my experience) a fluke born out of desparation? :-)
*cough* I didn't know that the 'for' modifier created a lexical block.
Until Ton announced my "innovation", I thought that it acted just like
the 'while' modifier. :-)
One of my last attempts before going sailing for the weekend was this:
#!perl -l
1=~/$/;($`%1e9*++$n)=~/0*$/ while $ARGV[0]--;print$`%10
__END__
After coming back I got to 49 from 50 with my regular approach, and
then stalled. I dug the $` approach back from the archives, dusted it
off a little, and it was almost respectable:
#!perl -l
1=~/$/;/0*$/while$_=$`%9e9*$ARGV[0]--;print$`%10
__END__
Optimize for the empty regexp:
#!perl -l
1=~/0*$/;//while$_=$`%9e9*$ARGV[0]--;print$`%10
__END__
While -> for:
#!perl -l
1=~/0*$/;($`%9e9*$_)=~//for 1..pop;print$`%10
__END__
And the rest practically writes itself.
> And of course, congratulations to Ton and the other referees for a
> well-designed and well-run competition. Interesting holes, solutions always
> judged promptly, exciting races until the end, and by far the best test
> script we've ever seen!
Absolutely!
--
Juho Snellman
"C:stä on kehitetty Massachusettsin teknillisessä korkeakoulussa kieli
nimeltä BCPL."
Thread Previous
|
Thread Next