in reply to Constant string reference
There is a readonly subroutine in Scalar::Util that you can use to do this simply, or If you have Inline available you can do this yourself trivially:
use Inline C; + my $FOO = "Bar"; + readonly($FOO); + $FOO = "GG"; __DATA__ __C__ + void readonly(SV *sv) { SvREADONLY_on(sv); }
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Constant string reference
by Fletch (Bishop) on Dec 09, 2004 at 13:03 UTC |