Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: lexical variable

by manishrathi (Beadle)
on Oct 06, 2009 at 15:50 UTC ( [id://799516]=note: print w/replies, xml ) Need Help??


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

Replies are listed 'Best First'.
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://799516]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-23 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found