in reply to &&= vivify keys?
I expected the previous code to modify the hash only if the key is already there (and with a true value) .... Am I missing something?
Consider
$ perl -MData::Dump -e " $foo = 1; dd $foo; $foo &&= 5; dd $foo; " 1 5 $ perl -MData::Dump -e " $foo = undef; dd $foo; $foo &&= 5; dd $foo; " undef undef
$foo exists regardless of the value it has. Similarly $foo{bar} exists by the virtue that you try to assign a value to it (l-value context).
Its like writing $foo{bar} = ( $foo{bar} && 5 );
|
|---|