Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Dear monks, I am referring to the book, 'Professional Perl Progamming' by Peter Wainwright and have a doubt on page 260..

for the explanation of use var, it says..

Varivables declared with use vars are plugged into the symbol table for the current package at compile time, because use takes effect at compile time

and then in next page the explanation for our goes like...

..our works like use cars inthat it adds a new entry to the symbol table for the current package. However, unlike use vars it does this at compile time, not run time. This means that the cariable can be accessed without a package prefix from any package , butt only so long as its lexical scope exists. THis means that a package variable, declared with our at the top of the file, is global throughout the file even if it contains more than one package, just as we would normally expect a global vaiable to be.

Can any one help me to understand

1)about the diff in reading at compile time and run time. Mean to say, how this is making diff to the symbol table..

2)Ain't above two are saying same thing as that these are plugged at compile time only..


In reply to Diff b/w mods for plugging variables into symbol table:'use var' and 'our' by cool

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-24 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found