* Ovid <[EMAIL PROTECTED]> [2005-08-12 23:40]: > Yes, but you're altering the hash passed in by reference.
Fair point, and trying to avoid that does get ugly. I don’t run into it much because I usually take named params directly in @_ instead of via a hashref. sub foo { my ( $args ) = @_; my %default = ( foo => 1, bar => 1, baz => 'quux' ); my @optional_keys = qw( wibble wobble ); my %have_keys = map { $_ => undef } keys %$args; delete @have_keys{ keys %default, @optional_keys }; croak "I have no idea what you mean by @{[ keys %have_keys ]}" if %have_keys; my %args = ( %default, %$args, map { exists $args->{ $_ } ? ( $_ => $args{ $_ } ) : () } @optional_keys, }; # ... } But the point still stands that I’d be likelier to keep a copy of a function for this purpose in my snippets file than to depend on a module that doesn’t provide anything but it. Also the point about lock_keys, which makes all of this a non-issue. Regards, -- #Aristotle *AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}; &Just->another->Perl->hacker;