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

Not existing, or zero:
$var = !exists $hash{key} || $hash{key} eq "0" ? 0 : 1;
Undefined (including not existing) or zero:
$var = ($hash{key} // 0) eq "0" ? 0 : 1;
False (which includes zero, undefined, non-existing and empty):
$var = $hash{key} ? 1 : 0;
Note the eq "0" instead of == 0; this avoids warnings if the keys contains strings that don't look like a number.