From: "Michael R. Wolf" <[EMAIL PROTECTED]> > When dealing with "my", you can look at the line that > declares it, then backup to the smallest enclosing brace. > The variable belongs to that scope. A scope is defined by > an open/close brace pair. Lexicals are accessible anywhere > within the code of that scope.
Not exactly true. The scope is from the definition to the closing brace. Not the whole block. Try this $perl use strict; { print "$x"; my $x = 5; print "$x"; } Plus there are a special "syntactic sugars" : for (my $i = 0; $i < 10; $i++) { ... } where the scope is the code in the round braces plus the inner block. See : use strict; { for (my $i = 0; $i < 10; $i++) { print "$i\n"; } print "Outside: $i\n" } Similar for "foreach my $var (@array) {...}" and "while (my $i = <HANDLE>) {...}". Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]