Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

RE: History of 'our'

by autark (Friar)
on Jul 22, 2000 at 22:47 UTC ( #23915=note: print w/replies, xml ) Need Help??


in reply to History of 'our'

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2020-11-30 06:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?