http://qs321.pair.com?node_id=23915


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