Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: 'our' scoping

by Sandy (Curate)
on Jun 02, 2004 at 14:00 UTC ( [id://359440]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: 'our' scoping
in thread 'our' scoping

Thankyou thankyou thankyou...

You have fixed many confusions that I had. I thought that 'use vars' and 'our' were identical, and it did cause me some confusions because some of my code has a mixture of both (pre 5.6 and post 5.6).

I went back and re-read the our documentation in the camel book and it is very precise, and now I understand (I think) what it is talking about.

However, when I went back and re-read the use vars documentation in the camel book, I realize the source of my confusion...

quote (my italics)

use vars qw($frobbed @munge %seen);
This pragma, once used to declare a global variable, is now somewhat deprecated in favor of the our modifier. The previous declaration is better accomplished using :
our ($frobbed, @munge, %seen);
...

No matter which of these you use, remember that they're talking about package globals, not file-scoped lexicals.

This information had led me astray (it may be technically correct, but it confused me nonetheless).

In closing, I would be really appreciative if you would turn your post into a mini-tutorial.

Thanks,

Sandy

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-28 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found