Prototypes serve two purposes in Perl: they give the parser hints on what to expect (for example the (&) prototype means that parser expects a block after the subroutine name, just like map does), and they provide context (a sub with a ($) prototype imposes scalar context onto the argument).
They are not signatures, you can't use them to validate your arguments, unpacking argument lists or anything like that. See perlsub and Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl for more details.
In reply to Re: subroutine prototype in Perl
by moritz
in thread subroutine prototype in Perl
by pavunkumar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |