Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: what is the scope of my $x=$xby davorg (Chancellor) |
on Jun 05, 2006 at 10:46 UTC ( [id://553565]=note: print w/replies, xml ) | Need Help?? |
What happened when you tried it out? There are two variables called $x there. The one on the left hand side of the assignment is a lexical variable and it will be in scope from this statement until the end of the innermost enclosing block. On the right hand side of the assignment is a existing package variable and its scope depends on where and how you created it. By default its scope will be the whole of the package that it was created in. Try experimenting with this code:
-- <http://dave.org.uk> "The first rule of Perl club is you do not talk about
Perl club."
In Section
Seekers of Perl Wisdom
|
|