Help for this page

Select Code to Download


  1. or download this
    sub whatever {
        my %params = @_;
    ...
    
    whatever key2 => $value2;
    whatever keyq => $value1; # Hash has key 'keyq' which is not in the ne
    +w key set
    
  2. or download this
    use Getopt::Long qw/:config bundling/;
    use Hash::Util qw/ lock_keys /;
    ...
    my @OPT_SPEC = qw/ help|h version noact|no-act|dry-run DEBUG output|o=
    +s /;
    GetOptions \%OPT, @OPT_SPEC or ($OPT{help} = 1);
    lock_keys(%OPT, map /^(\w+)/, @OPT_SPEC);
    
  3. or download this
    # Option 1: use Params::Validate
    
    ...
        lock_keys %params, keys %expected_params;
        # ...
    }