Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Use of "my" after Perl v5.14

by Rohit Jain (Sexton)
on Sep 20, 2012 at 22:31 UTC ( #994769=note: print w/ replies, xml ) Need Help??

in reply to Use of "my" after Perl v5.14

Ok.. so I was just getting confused with local variable as private variables.. They both are same.. just the name used at a wrong place.. Because private and public should come at a place where you start talking OOP.. It is just global and local variables in this case.. am I right??

Comment on Re: Use of "my" after Perl v5.14
Replies are listed 'Best First'.
Re^2: Use of "my" after Perl v5.14
by marinersk (Curate) on Sep 20, 2012 at 22:43 UTC
    Actually, I will confess to an atypical ignorance on the difference between "local" and "private" and will defer to the real Perl experts on this forum to answer your very appropriate question.

    The point I was trying to make is that to make a variable which is global to a source file, you put the "my" outside all subroutine defintions, and that you could make a relatively localized variable which persists its value through the use of braces in what I believe is called "lexical scoping".

    Regardless of the terms, the sample demonstrates a number of functionally distinct scope limits for your variables.

    We should know the professional terms, but I, frankly, don't.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2015-07-31 07:53 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (275 votes), past polls