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.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

Reply via email to