Copy a string: Difference between revisions

m
→‎{{header|Perl 6}}: update to ease automated testing
No edit summary
m (→‎{{header|Perl 6}}: update to ease automated testing)
Line 1,455:
<!-- SqrtNegInf 2016-01-16 This is NYI, so until such time as it is, leaving this section commented
You can also create a read-only binding which will allow read access to the string but prevent modification except through the original variable.
<lang perl6>my# y $original = 'Hello.';
#my $bound-ro ::= $original;
#say $bound-ro; # prints "Hello."
#try {
# $bound-ro = 'Runtime error!';
# CATCH {
# say "$!"; # prints "Cannot modify readonly value"
# };
#};
say $bound-ro; # prints "Hello."
$original = 'Goodbye.';
10,343

edits