So I am a beginning Perl programmer. I have been using it for about a month, however only in the last week or so have I been using it for anything other than sysadmin type tasks. In doing so I ran into the following question,
Perl subprocesses are really flexible, and they don't impose many/any constraints on arguments you pass in. How is it possible to either enforce the number of arguments and/or check whether they're references, scalars etc etc?
To clarify, here's what I currently do for Perl subprocesses:
sub mySub{
($a, $b) = @_;
continue and use these methods
}
But this provides no guarantees about what $a
and $b
hold. Is there anyway to make sure they contain values, say a reference for $a
and a scalar for $b
?
Thanks in Advance.
EDIT: When I said scalar for $b
I mean containing an integer, and not being a reference to some other datastructure.