in reply to Re^2: Inexplicable uninitialized value when using (?{...}) regexp construct.
in thread Inexplicable uninitialized value when using (?{...}) regexp construct.
I got bitten by this a few times early on, without necessarially realising that the cause was the closures caused by using lexicals in the code blocks. I just found that using our and/or local meant things worked as I wanted them too.
This is one of the few places where the closure behaviour of Perl's lexicals is distinctly not useful.
I've never seen any mention of this in the POD, though it has come up here and on p5p a few times. I think a documentation patch is a very good idea, though I have my doubts as to the usefulness of a full explanation of the causes and effects. I think a simple "Don't use lexicals in code assertions!" would probably suffice, be more beneficial and less confusing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Inexplicable uninitialized value when using (?{...}) regexp construct.
by davido (Cardinal) on Sep 29, 2004 at 01:15 UTC | |
by BrowserUk (Patriarch) on Sep 29, 2004 at 01:36 UTC |