Dear fellow monks
I have the following code getting a value of a hash. If the element is not existing or zero, I want to assign "1" to a variable, otherwise the value contained in the hash. The code below does the trick, but looks very clumsy :-( . Can you please propose a more elegant solution?
Thanks in advance! Rata
$nr = $metricOpenTasks {$relWeek}{$cc}{"nr"}; $nr = 1 if (!defined ($nr) || ($nr == 0));
update: Updated the description - thanks jethro for finding this mismatch!
In reply to undefined or zero: looking for an elegant solution by Ratazong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |