On 19/11/17 13:57, hw wrote: > without being able to use feature 'signatures', how do I verify > that parameters passed to a function have been passed to it by > the caller?
If you're dealing with positional parameters[1] (and not with named ones) you can check for the size of @_ inside your function, that is, you can check for the quantity of parameters given by the caller. sub one { $num_of_params = scalar @_; print "$num_of_params\n"; } one('str1'); # prints '1'; there's just one parameter one('str2', undef); # prints '2'; the second parameter is undef, # but the undef counts and it prints '2' [1] Positional parameters would be as in sub_one('John', 'Zimbabwe'); and named parameters as in sub_two({ name => 'John', country => 'Zimbabwe' }); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/