if (defined(my $foo = exists $hash{$key})) { # ... } #### if (exists $hash{$key}) { my $foo = $hash{$key}; # ... }