in reply to detecting changes in a localised variable
Here I tie $_ to a Complainer package that can warn/carp/croak any time something tries to assign to it.
#!perl -l package Complainer; use Tie::Scalar; use base Tie::StdScalar; use Carp; sub STORE { # Warn out any status info you want here. carp "Tried to assign to \$_"; } sub FETCH { $_ } package main; tie $_, Complainer; $_ = 1; local $_;
Update: Added the fetch method so that reading $_ actually works. not sure why I have to do that, Tie::StdScalar should handle that for me... but this was written in a hurry.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
In Section
Seekers of Perl Wisdom