What the OP wants is:$foo = $bar unless defined $foo;
which is equivalent to$foo = $bar // $foo;
assuming the absence of ties and overloading.$foo = $bar if defined $bar;
In reply to Re^2: Assignment to a value only if it is defined
by JavaFan
in thread Assignment to a value only if it is defined
by voj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |