use Params::Validate qw (validate_with); sub example_method { my $self = shift; my %args = validate_with ( params => \@_, spec => { thing => 1, handle => 1 }, normalize_keys => sub { return lc($_[0]); }, ); my ($handle, $thing) = @args{'handle','thing'}; #... } #### use Class::ParmList qw (simple_parms); sub example_method { my $self = shift; my ($handle, $thing) = simple_parms(['handle','thing'],@_); #... } #### use Sub::Parms; sub example_method { Invokation : $self; NamedParam : $handle (+handle); NamedParam : $thing (+thing); #... } #### sub example_method { my $self = shift; my %args; { my %raw_args = @_; %args = map {lc($_) => $raw_args{$_}} keys %raw_args; } unless ($args{'handle'}) { croak("Missing 'handle' argument"); } unless ($args{'thing'}) { croak("Missing 'thing' argument"); } unless (4 == @_) { croak("Unexpected extra parameters"); } my ($handle,$thing) = @args{'handle','thing'}; #... }