use Params::Validate qw(validate); sub convert { my %args = validate(@_, { from => 1, to => 1, thing => 1}); # ... }