if (my $value = $hash1->{a}->{b}->{c}) { $hash2->{bob} = $value; } #### if (my $ref = $hash1->{a}->{b}) { $hash2->{bob} = $ref->{c} || $ref->{d}; }