Vautrin: You are right about "sub foobar {...}" being the right way to code unless and until you completely understand what Perl calls "prototypes". However, otherwise your post is almost completely false. Specifically:
- prototypes do not provide checking of argument number and type. They might look like they do, but they don't.
- the "@" and "%" prototypes do not mean "array" and "hash".
- the "\@" and "\%" prototypes do not mean "arrayref" and "hashref".
Once more:
prototypes do not provide checking of argument number and type.
Why even have them then? Good question. Tom Christiansen's prototypes explanation explains the whole situation. It is detailed and crystal-clear.
If you want to check number and type of arguments, the best way is to do it by hand.