Please consider using the cleaner perl5.10 variant //= if you expect $some_ref->{id} to be nonexistent / not defined.
$some_href->{id} //= 0
This makes it explicit that you only want to set id when it was not defined before. Then the truthy, falsy nature of '', 0 and other variants is no longer of concern.