in reply to Re: Why is this
in thread Why is this
There is no way to express that a variable is, or that it must be, "a reference to this-or-that."
You can code it yourself, of course:
For more robust solutions, there are (of course) modules on CPAN, such as Data::Validate, Params::Validate, Sub::Contract, and Arguments, among many others. (Note that some only work for validating arguments to subroutines. Often this is all you need.)ref($x) eq 'HASH' or die "D'oh! \$x must be a hash!";
|
|---|