[tpm] Modification of a read-only value
Shaun Fryer
sfryer at sourcery.ca
Thu Apr 22 18:39:31 PDT 2010
I'm curious why a scalar reference is considered a read-only value?
$ perl -le 'my $x = \"0"; $$x++; print $$x'
Modification of a read-only value attempted at -e line 1.
$ perl -le 'my $x = {x=> 0}; $x->{x}++; print $x->{x}'
1
Is there an easy way to update a simple scalar ref without having to
use an array or hash ref instead?
Fyi... This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
--
Shaun Fryer
More information about the toronto-pm
mailing list