in reply to 'my' buggy...
Since some people, including me, initially wrongly thought the problem here was the 'my' declaration and pointed out the ugly my trick I ended up looking through to find out where it was I first learnt about it.
It turned out to be in Exegesis 4, and now having read it again I find it came with a link to a warning about the 'my trick'. Since some may read this and think 'Hey, neat trick.. I didn't know that' I thought putting the warning here was in order.
It reads as follows.
NOTE: The behaviour of a my statement modified with a statement modifier conditional or loop construct (e.g. my $x if ...) is undefined. The value of the my variable may be undef, any previously assigned value, or possibly anything else. Don't rely on it. Future versions of perl might do something different from the version of perl you try it out on. Here be dragons.
|
|---|