in reply to call subroutine if scalar is changed
I'd go for Tie::Scalar for such a case. It is part of the core modules.
In your class based on Tie::Scalar you then override the STORE method with one which calls your routine, and then the original STORE from the base class. perltie gives an overview about the technique.
|
|---|