#! perl
use strict;
use warnings;
my $s = 'fred';
print "\$ = $s\n";
$s = 'barney';
print "\$s = $s\n";
Internals::SvREADONLY($s, 1);
$s = 'wilma';
print "\$ = $s\n";
####
19:04 >perl 723_SoPW.pl
$s = fred
$s = barney
Modification of a read-only value attempted at 723_SoPW.pl line 10.
19:07 >
####
#! perl
use strict;
use warnings;
my $s = 'fred';
print "\$s = $s\n";
$s = 'barney';
print "\$ = $s\n";
Internals::SvREADONLY($s, 1);
Internals::SvREADONLY($s, 0);
$s = 'wilma';
print "\$ = $s\n";
####
19:10 >perl 723_SoPW.pl
$s = fred
$s = barney
$s = wilma
19:12 >
####
#! perl
use strict;
use warnings;
for my $s ('fred')
{
print "\$s = $s\n";
Internals::SvREADONLY($s, 0);
$s = 'wilma';
print "\$ = $s\n";
}
####
19:14 >perl 723_SoPW.pl
$s = fred
Modification of a read-only value attempted at 723_SoPW.pl line 9.
19:16 >