# With ternary my $x = exists $hash{key} ? $hash{key} : 'default' # Without my $x; if (exists $hash{key}) { $x = $hash{key}; } else { $x = 'default'; } #### # With ternary my $x = $x > 5 ? 5 : $x + 1; # With if if ($x > 5) { $x = 5; } else { $x++; } #### my $x = $y > 5 ? ($y = 0) : ($y = 1);