http://www.perlmonks.org?node_id=183747

Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:

I think the title says it all, but:
  1. if I've written a sub or module which expects, say, three variables to be passed to it, what should it do when it gets two?
  2. What if it gets four?
  3. What's the correct position on whether it should die, warn, or just return an error message?
  4. How detailed should the error message be? Should I say:
    1. Wrong number of parameters! I need three!
    2. Wrong number of parameters! Correct syntax is my_sub($name,$phone,$address)
    3. Wrong number of parameters! Correct syntax is my_sub($name,$phone,[$address|@address]) -- for instance, if one of the parameters can be an array or a scalar
    4. Wrong number of parameters! Correct syntax is my_sub($name,$phone,$address)
    5. Wrong number of parameters! See documentation!
Thanks.
--
($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;