Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't know much about its history, but I know the 'our' keyword is something that had been planned for a long time. The deprecated warning was put in in perl5 (don't remember exactly when) because they knew that they eventually where going to support it.

Thus if you say:

perl -lwe 'sub our { print shift } $foo = "bar"; our $foo'
you'll be warned by perl that your _use_ of the _reserved_ word 'our' is now deprecated (as in don't do that :-).

The 'our' keyword has not had any function prior to perl5.6 (unless you count experimental versions that is).

But why did they have to tell us not to use 'our' ? Well, take a look at that code again. In perl prior to 5.6 it prints "bar" (and may give you the warning) - in perl5.6 it doesn't print anything out because you now declare the $foo variable rather than sending it to a function called 'our'.

Autark


In reply to RE: History of 'our' by autark
in thread History of 'our' by jeffa

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 avoiding work at the Monastery: (1)
As of 2024-04-19 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found