Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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

Replies are listed 'Best First'.
Re: Usage of scope resolution operator :: without package name
by LanX (Chancellor) 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

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.