in reply to RE: Re: When is my variable not really mine?
in thread When is my variable not really mine?
What I don't understand is how you can know that the value of your variable has changed unless you're doing some execution of code within your block. If you're entering a block with a 'my' variable, leaving that block to execute some other code, and returning to it, the variable is recreated and undefined on the 2nd run. Consider:
If we could see some code we could explain what's going on, probably. Also make sure you're using 'strict'. This will catch lots of problems like this.sub a { my $var = 1; &b; # Can't touch $var eval $set_var_to_2; # Code in this variable can affect $var print "$var\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: Re: When is my variable not really mine?
by gaspodethewonderdog (Monk) on Sep 07, 2000 at 19:03 UTC | |
by jcwren (Prior) on Sep 07, 2000 at 19:07 UTC |