in reply to Re: lexical variable in thread lexical variable
1) If I declare a variable $first in a FirstFile.pl at the top without "my" , does it become package variable ? What package does it belong to ? How can it be accessed in SecondFile.pl ?
2) If a variable is declared as "$first" and another variable is declared as "my $second" in FirstFile.pl at the beginning of the program, can "my $second" variable be used in subroutines of FirstFile.pl ? I guess "$first" can be used in subroutines of the FirstFile.pl
3) $first is declared as package variable. But what package does it belong to ? How this variable be accessed in SecondFile.pl ? I guess "my $second" can not be used in SecondFile.pl
Re^3: lexical variable
by moritz (Cardinal) on Oct 06, 2009 at 16:44 UTC
|
See also the replies to main package
And did you actually read the nodes I linked to, and the documentation? It explains quite a bit.
Perl 6 - links to (nearly) everything that is Perl 6.
| [reply] |
|