in reply to Re: Re: Re: static-like persistence of my variable due to trailing conditional
in thread static-like persistence of my variable due to trailing conditional

I concur, except for this part:
So when you call mycode() with no arguments then my $foo = 'blah' is not executed at all. Instead, simply $foo = 'FOO' gets executed, setting $main::foo (you can verify this by printing out $main::foo after you call mycode() with no arguments).
I had a line in my original code that dumped the symbol table:

print Dumper(\%main::);

But threw this out because I am never able to see $foo in the symbol table for the main package. Are you?

---
"A Jedi uses the Force for knowledge and defense, never for attack."

  • Comment on Re: Re: Re: Re: static-like persistence of my variable due to trailing conditional