sub new { my ($self, %param) = @_; my ($dbh, $foo) = map { $param($_) || croak "need $_" } qw(dbh foo); # ... stuff that uses $dbh and $foo ... }