Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Note on usage of ours variables and a question

by AnomalousMonk (Bishop)
on Nov 20, 2019 at 02:13 UTC ( #11108924=note: print w/replies, xml ) Need Help??


in reply to Re: Note on usage of ours variables and a question
in thread Note on usage of ours variables and a question

Variables written ... with a "^" sign and in braces ... are automatically global and available everywhere in your program, without needing to be declared.

So is any fully-qualified package-global (even under strictures):

c:\@Work\Perl\monks>perl -wMstrict -le "{ package Foo; $::bar = 'Baz'; sub p_bar { print $::bar; } } ;; Foo::p_bar; ;; { package Fiz; sub new_bar { $::bar = 'Boff'; } } Fiz::new_bar; Foo::p_bar; ;; $::bar = 'Quux'; print $::bar; " Baz Boff Quux


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2021-10-21 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (83 votes). Check out past polls.

    Notices?