$x{$k} &&= $v;
I expected the previous code to modify the hash only if the key is already there (and with a true value), or leave the hash untouched otherwise.
Instead it add the key also if it's missing, but with undef value.
Am I missing something?$ perl -E 'use Data::Dumper; my %x; $x{a}&&=1; say Dumper(\%x);' $VAR1 = { 'a' => undef };
TIA
This is perl 5, version 12, subversion 4 (v5.12.4) built for x86_64-li +nux-gnu-thread-multi
In reply to &&= vivify keys? by oha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |