in reply to How best to validate the keys of hashref arguments?

I'm not sure which kind of parameter checking you want, maybe counting a hash slice is just enough?

@allowed_keys = qw/name user host command/; my %allowed; @allowed{@allowed_keys} = delete @$cmd{@allowed_keys}

any remaining entries you get from keys %$cmd can't be allowed, an if %allowed has less then 4 entries you might need to throw an error.

Alternatively you can preset %allowed with default values in the second line, which are overwritten if present.

Hope this helps.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!