You're not really handling that case, you're just silencing a warning. Zero and undef still compare as equal. Note the use of cmp to differentiate zero from undef (I may have added that while you were typing your reply).
Caution: Contents may have been coded under pressure.