http://www.perlmonks.org?node_id=900336


in reply to Detect variable change?

Smart::Comments and Devel::Trace may also be of interest. With the former you'd just use it and add a comment like ### $my_variable where you want to see its value (and the nice thing is you just comment out the use Smart::Comments line and it becomes just a plain old inert comment that doesn't affect your program or its output).

The cake is a lie.
The cake is a lie.
The cake is a lie.