Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Lexicals in if() scope gotcha!

by liz (Monsignor)
on Mar 31, 2004 at 21:49 UTC ( #341437=note: print w/ replies, xml ) Need Help??


in reply to Re: Lexicals in if() scope gotcha!
in thread Lexicals in if() scope gotcha!

Are you sure?

use strict; use warnings; foreach my $foo (1..10 ) { print $foo } foreach my $foo (1..10 ) { print $foo } __END__ 1234567891012345678910
I'm not seeing any errors or warnings using Perl's from 5.6.2 -> 5.9.0. I would be surprised if it would produce any warnings or errors, as this is an idiom that I use myself from time to time (without warnings, I might add).

Liz


Comment on Re: Re: Lexicals in if() scope gotcha!
Download Code
Re: Re: Re: Lexicals in if() scope gotcha!
by ambrus (Abbot) on Apr 02, 2004 at 19:50 UTC

    Ok, you're right. I can't reproduce the error now, so I must have made some error like declaring $n inside the for loop's body or something like that.

    Thanks for clarifying this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://341437]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-08-31 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls