sub name { # this puts the passed list into a hash my %arg = @_; # this transfers values to variables and removes the keys my ($key1, $key2) = delete @arg{qw(key1 key2)}; # this determines if any keys are leftover croak 'Illegal arguments' if %arg; }