my @defaults = qw( foo bar baz ); my ($arg0, $arg1, $arg2) = map { $_[$_] || $defaults[$_] } 0..$#_;