Re: Perl realted..?
- From: "Nelson Castillo" <nelsoneci@xxxxxxxxx>
- Date: Fri, 11 Jan 2008 10:39:25 -0500
On Jan 10, 2008 1:23 PM, Chris Howie <cdhowie@xxxxxxxxx> wrote:
On Jan 10, 2008 1:11 PM, ISHWAR RATTAN <rattan@xxxxxxxxxxxxx> 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 debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
- References:
- Perl realted..?
- From: ISHWAR RATTAN
- Re: Perl realted..?
- From: Chris Howie
- Perl realted..?
- Prev by Date: Re: Perl realted..?
- Next by Date: GNU style Changelog for SVN in Emacs (was: emacs and svn)
- Previous by thread: Re: Perl realted..?
- Next by thread: Re: Perl realted..?
- Index(es):
Relevant Pages
|
|