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

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 $_.