Unfortunately, you're confused. But it's a mistake that many people make. I myself was confused until I read this useful article on Prototypes in Perl.
Basically, prototypes are not for catching errors at compile time. Rather, they're for changing the precedence of the subroutine calls.
Normally (when not using parentheses or pototypes), subroutine calls act as list operators, meaning the slurp up everything after them. For example:
print my_sub 1, "\n"; # Actually means: print my_sub(1, "\n");
Prototypes allow you to change this behaviour so that the subroutine call only slurps up as many values as it needs (unless, of course, you explicitly use parentheses).
The article does a better job of explaining it but I hope that helps at least some. :-)
bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.
In reply to (bbfu) (prototype misconception) Re(2): Declaring Subroutines (predeclare, catch errs at compiletime?)
by bbfu
in thread Declaring Subroutines
by the_0ne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |