in reply to Passing hashes as arguments to a sub?
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing hashes as arguments to a sub?
by leocharre (Priest) on Nov 28, 2005 at 19:29 UTC |