Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Usage of scope resolution operator :: without package name

by prasappu (Initiate)
on Sep 13, 2012 at 11:30 UTC ( #993463=perlquestion: print w/ replies, xml ) Need Help??
prasappu has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Can I use the scope resolution operator without package name on its left side? (example-> ::sub1() ) And also, what is the meaning of $ is on the left side of :: (like $::) Thanks, Prasad

Comment on Usage of scope resolution operator :: without package name
Re: Usage of scope resolution operator :: without package name
by daxim (Chaplain) on Sep 13, 2012 at 11:38 UTC
    Yes. No package name is a shortcut for the default package name main.
Re: Usage of scope resolution operator :: without package name
by nemesdani (Friar) on Sep 13, 2012 at 11:39 UTC
    Yes. It means the main package. As ambrus pointed it out for you.




    I'm too lazy to be proud of being impatient.
Re: Usage of scope resolution operator :: without package name
by LanX (Canon) on Sep 13, 2012 at 11:47 UTC
    As a side note, it's called "package separator"!

    In Perl a (lexical) scope is something quite different!

    Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://993463]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-08-23 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (169 votes), past polls