for (1 .. 4) { my $foo = $questions->{$_} && $questions->{$_}{foo} || "daklfjsdalk"; }