sub foo { my %args = @_; my ($a, $b, $c, $d) = @args{qw( a b c d )}; # Or: my ($a, $b, $c, $d) = @{{@_}}{qw( a b c d )}; ...; }