Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Our, use vars, and magic, oh my!

by arturo (Vicar)
on Aug 23, 2001 at 18:14 UTC ( [id://107331]=note: print w/replies, xml ) Need Help??


in reply to Re: Our, use vars, and magic, oh my!
in thread Our, use vars, and magic, oh my!

The fact that a variable is lexically scoped doesn't imply anything about the internal implementation. Lexical scoping is more a matter of syntax than anything else.

According to the man page perlfunc:our or perldoc -f our, you can see that what the package Foo; our $foo; declaration does is get the interpreter to see occurrences of $foo unadorned, as it were, as occurrences of $Foo::foo, so it's a plain ol' package global:

An "our" declaration declares a global variable that will be visible across its entire lexical scope, even across package boundaries. The package in which the variable is entered is determined at the point of the declaration, not at the point of use.

HTH

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found