%$hash_ref or return; #### %$hash_ref or return undef; #### keys %$hash_ref; # reset iterator #### 18:30 >perl -MData::Dump -wE "sub f { return (17, 42); } my %h = ( key1 => (f())[0] // undef ); dd \%h;" { key1 => 17 } 18:30 >perl -MData::Dump -wE "sub f { return (); } my %h = ( key1 => (f())[0] // undef ); dd \%h;" { key1 => undef } 18:30 >