# With ternary my $x = exists $hash{key} ? $hash{key} : 'default' # Without my $x; if (exists $hash{key}) { $x = $hash{key}; } else { $x = 'default'; }