On Thu, 8 Aug 2002, Juho Snellman wrote:

> 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. :-)
> 

Ah yes, the good old "luck" approach!

I have to admit I didn't even remember that $` was confined to the dynamic
scope until I tried something like

#!perl -l
($`%9e9*$_||1)=~/0*$/for 0..pop;print$`%10    # BROKEN!


By the way, isn't it incredibly annoying that there isn't a single Perl
variable which defaults to 1? (My UID is 1000, which would have worked well,
but I doubted it met the "work everywhere" constraint. :-)

-- 
Stephen Turner, Cambridge, UK    http://homepage.ntlworld.com/adelie/stephen/
"This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01

Reply via email to