in reply to There is a way to LOCK a SCALAR?

With 5.8.0, there was added a builtin way to do this:
Internals::SvREADONLY($your_scalar, 1);
As the name reflects, it was added for internal use (by the restricted hash feature). Don't depend on it staying there or under that name in future perl releases.