{ $hash{data} = $_ if defined ( local $_ = $something ); }
A simple if-block is not to be faulted but if you are going to use a single statement a large $something should come last; else it will obscure following logic.
With the above it is easy to forget to close a scope over the local.
Be well,
rir
In reply to Re: Shortcut operator for $a->{'b'}=$b if $b;
by rir
in thread Shortcut operator for $a->{'b'}=$b if $b;
by rokadave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |