in reply to prototypes: so many \@'s?

Even if you are aware, maybe it is good to remember: "Don't use prototypes". Except in a very small number of cases of restricted utility (like ($$) prototyped functions used with sort), they don't do what you want (unless you're very weirdo to match the craziness of Perl prototype semantics).

One example:

sub foo ($$) { $_[0] + $_[1] } # add two scalar args :) foo(1,2) @a = (1,2); foo(@a); # death !! not enough arguments @b1 = (2); @b2 = (3); foo(@b1,@b2) # 2 !?!? = scalar @b1 + scalar @b2

And don't take my words. Tom Christiansen said that a long time ago and Damian Conway said more about it in "Perl Best Practices".

That said, maybe you may get the behavior you want with a module like Params::Validate. See the docs with a special attention to the section on "Callback Validation":

Replies are listed 'Best First'.
Re^2: prototypes: so many \@'s?
by BrowserUk (Pope) on Apr 03, 2007 at 21:07 UTC

    This particular form of prototype provides a facility that cannot be achieved any other way. Perhaps you should understand what that facility is before handing out old and well worn advice those who already know it.

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.