programming-examples/perl/SystemFunction/Is scalar readonly.pl
2019-11-15 12:59:38 +01:00

8 lines
261 B
Perl

#!/usr/bin/perl -w
use Scalar::Util qw(readonly);
my $constant="immutable";
print "scalar is ",(readonly($constant)?"constant":"variable"),"\n";
Internals::SvREADONLY($constant => 1);
print "scalar is ",(readonly($constant)?"constant":"variable"),"\n";