Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
how about a closure where you want to use a var declared outside of the closure Well, by definition, a closure does operate on variables outside itself... that's the whole point. As for a closure that is based on a global variable (lexical or otherwise), I can only ask "Why would you want to do a thing like that?" If the variable is global, it sort of defeats the purpose of wrapping it up in a closure. (Otherwise you would just use local). So yes, you could do so, but I don't think it qualifies as a Real World Example™ as per the OP. I think anything you could come up with could be wrapped up in a sub and use lexical mys, and I think it would be better that way. - another intruder with the mooring of the heat of the Perl In reply to Re^2: Use of 'our' considered harmful
by grinder
|
|