On Aug 25, 2000 at 21:25:59 -0400, Rick Myers twiddled the keys to say:
> On Aug 25, 2000 at 21:02:32 -0400, Billy Donahue twiddled the keys to say:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > On Fri, 25 Aug 2000, Rick Myers wrote:
> > 
> > > From: Rick Myers <[EMAIL PROTECTED]>
> > > 
> > > On Aug 24, 2000 at 23:15:15 -0500, Ken Williams twiddled the keys to say:
> > > > [EMAIL PROTECTED] (Rick Myers) wrote:
> > > > >
> > > > >+    ++$lines while defined <FH>;
> > > > 
> > > > THAT's weird - what in the world is the read-only value that's being
> > > > modified?  
> > > 
> > > It's $_.
> > 
> > And why is $_ read-only?
> 
> I'm clueless about the perlguts involved here, but I'm thinking
> ultimately because it's global...
> 
> perl -e 'test($_) for qw/a b c/; print "OK\n"; sub test {$_=0}'
> Modification of a read-only value attempted at -e line 1.
> 
> perl -e 'test($_) for qw/a b c/; print "OK\n"; sub test {local $_=0}'
> OK

*Ugh*  I guess I have to correct myself here...

As it turns out, the perldiag page is correct. In the above examples $_
can't be modified because it "points" to constant values (the qw
construct).

perl -e 'for ($_=0;$_<5;$_++) {test($_)} print "OK\n"; sub test {$_=0}'
<produces an infinite loop>

perl -e 'for ($_=0;$_<5;$_++) {test($_)} print "OK\n"; sub test {local $_=0}'
OK

Nevertheless, the real problem in request.t is still the `while <FH>'.

Rick Myers                            [EMAIL PROTECTED]
----------------------------------------------------
The Feynman Problem       1) Write down the problem.
Solving Algorithm         2) Think real hard.
                          3) Write down the answer.

Reply via email to