in reply to undefined or zero: looking for an elegant solution

Your description does not match the code. You probably meant "If the element is not existing or zero, I want to assign "1"".

Wether the one-liner below is really more elegant is in the eye of the beholder, I would think your code looks clean and easy to read

$nr= $metricOpenTasks {$relWeek}{$cc}{"nr"} ? $metricOpenTasks {$relWe +ek}{$cc}{"nr"} : 1;

This assumes that empty strings do not occur or should also lead to an assignement of "1"