Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: if(my) scope

by citromatik (Curate)
on Apr 16, 2009 at 11:13 UTC ( #757939=note: print w/ replies, xml ) Need Help??


in reply to Re^3: if(my) scope
in thread if(my) scope

IMO the $h is visible entirely to the outer {} rather than 'if' block

No, it is not, a variable "lives" in the most inner block of code where it has been declared. If it is declared in an "if" condition or in a loop initialization, it is accessible only inside the "if" or loop block.

citromatik


Comment on Re^4: if(my) scope
Re^5: if(my) scope
by dave_the_m (Parson) on Apr 16, 2009 at 11:23 UTC
    Agreed. It's a bug: the compile-time and run-time scopes differ.

    Dave.

      not a bug, as already explained, but a sin...
      right now i always seen DESTROY called exactly when the refcount fall to zero. was pretty predictable.

      anyway by being clearly documented i expect changes in the future, and that force me to find another way.

      Oha

Re^5: if(my) scope
by citromatik (Curate) on Apr 16, 2009 at 11:35 UTC

    It is stated in the docs (as dada pointed out), so this is not a bug.

    citromatik

      Is a documented bug any less of a bug?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (19)
As of 2015-07-02 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls