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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.