in reply to Re: detecting changes in a localised variable
in thread detecting changes in a localised variable

That's a very interesting thread - thank you. I kinda got most of this, although not so clearly. The problem is that not all my co-workers get this, so I sometimes spend time dealing with the ramifications of their code :-) And this was somewhat of the problem here. (The problem was that the writer of the code in question didn't know the ramifications ... and that was me, because it was the first piece of perl code I had ever, ever written - 3+ years old, and in bad need of replacing. My co-workers still don't know the ramifications, however we now have coding standards that bypass the ramifications: while(<FH>) isn't allowed, and $_ should be avoided where it can. map, grep, etc., cannot avoid it, so go ahead there.)

  • Comment on Re^2: detecting changes in a localised variable

Replies are listed 'Best First'.
Re^3: detecting changes in a localised variable
by gaal (Parson) on Feb 19, 2005 at 16:44 UTC
    It's always impossible to know things before you learn them :)

    In the case of $_, the rule of thumb is to treat it as a global that will pollute calling code except where you specifically know it won't, e.g. foreach, map, and grep.

    In 5.9.1, you can lexicalize $_.