R. Joseph Newton wrote:
>
> Well, I tried it, and a few permutations thereof, and the only real
> difference I see with our is that the our makes the inner declaration
> a comment.

It only works that way if you've also declared the variable with 'our'
at file level. That way it's just a package variable that's visible
everywhere in the file. 'our' should be used only in those blocks
that need access to the variable, otherwise there's no point in
a declaration more local than the outermost level.

> Without the declaration of a local [not Perl local, just
> local] variable in the block, the block would have full access to the
> variable, anyway.
>

Again, only if you declare it at file level or don't 'use strict'.

>
> This has certainly been most instructive.  It also makes me very
> leery about declaring anyvariables outside of function definitions.
> I just don't see any real porotection coming from the my keyword
> alone.


I'm very concerned that you don't understand the use of 'our' properly.
Did you get my previous post in this thread? You followed up with a
post to Paul but I think you may have meant me as you quoted another
of my posts. There was an example in there that demonstrated using
'our' to implement a C-like 'static' variable.

I suggest trying again, but use 'our' only locally to blocks. And
believe
that there is more use to it than you've found. Keep asking questions
until you get there :-)

Cheers,

Rob






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to