use Params::Validate qw(validate); sub convert { my %args = validate(@_, { from => 1, to => 1, thing => 1}); # ... }
Constructing a more interesting example would require knowing what kind of data should be in the parameters. Params::Validate has some decent built-in type-checks and makes rolling your own easy.
-sam
In reply to Re: Your named arguments
by samtregar
in thread Your named arguments
by Juerd
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |