On Jan 10, 2008 1:23 PM, Chris Howie <[EMAIL PROTECTED]> wrote: > On Jan 10, 2008 1:11 PM, ISHWAR RATTAN <[EMAIL PROTECTED]> wrote: > > > I am coming back to perl after a long time. > > > > The sample code these days also uses variable attribute my as: > > > > my $inst = Extutils::Installed->new(); > > my @modules = $inst->modules(); > > > > Can any demistify 'my' for me?? > > > > -ishwar > > > > "my" declares a variable that exists within the current scope and is > unreachable from outside the scope. So a "my" declaration in one package > cannot be reached from another package. "our" is identical to "my" except > that you *can* reach that variable from other packages. A "my" declaration > inside of a function just limits the scope and lifetime of the variable to > that function.
I just wanted to point out that to take full advantage of "my" you might want to program using "use strict" also. N.- -- http://arhuaco.org -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]