in reply to USAGE OF Prototype

The only really good use for prototypes is the creation of syntactic sugar. Perl prototypes can let you do neat things like write your own custom grep function that you can call like this:

grepilicious {...} @someArray

Prototypes can also provide limited parameter checking but there are a lot of gotchas involved. In fact, so many that the standard advice is not to use them that way. Here are two:

Protypes can also interfere with good programming practice if you aren't careful. Passing @_ is a good way to cleanly define two almost alike subroutines. It is a lot less prone to typos than extracting all the parameters and then passing them one by one to a subroutine that takes the same parameters:

sub fooExtra { my $somethingExtra=shift; my $result=foo(@_); # combine $somethingExtra and $result in some way # and return, for example .... return $result + $somethingExtra; }

But if you define foo($;$) with a prototype, the above code won't work. Instead of passing the parameters, you'll pass the size of @_, which is not at all what you wanted.

Best, beth