You're just seeing the effects of perl's internals and how SVs can have multiple values and context is how perl determines which one to use (and assignment does not overwrite the entire SV but just that particular context). You can have fun with this with Scalar::Util's dualvar:
use Devel::Peek; qw( Dump ); use Scalar::Util qw( dualvar ); my $foo = dualvar 10, "Hello"; Dump($foo); print $foo, "\n"; print $foo + 5, "\n";
Update: And way down in the Storable pod is:
By default Storable prefers to store a scalars string representation (if it has one)
so ... yeah, that's going to give you problems with dualvars.
In reply to Re: Why do $x="$h->{foo}" and $x=$h->{foo} have different effects (as reported by Devel::Peek)?
by derby
in thread Why do $x="$h->{foo}" and $x=$h->{foo} have different effects (as reported by Devel::Peek)?
by ELISHEVA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |