I'll give you the obligatory plug to Tom Christiansen's excellent Prototypes in Perl article from perl.com. You seem to be only using prototypes to "use minimal error checking on the values passed to the subroutines" as you say (your other comments only refer to predeclaring subs). Tom's article explains well why prototypes don't really do this for you (or at least do it poorly at the cost of certain usability). Prototypes are cute sometimes to be able to pass references implicitly (a \@ prototype for instance), making your sub look more like a builtin (i.e, push)... but it looks like you understand how references work, so passing them explicitly and foregoing prototypes would probably be no skin off your back. Again, I can't explain it half as well as Tom does, so please read that article!

More on point to your original question, here's the relevant text from perldoc perlsub:

The prototype affects only interpretation of new-style calls to the function, where new-style is defined as not using the "&" character. In other words, if you call it like a built-in function, then it behaves like a built- in function. If you call it like an old-fashioned subroutine, then it behaves like an old-fashioned subroutine. It naturally falls out from this rule that prototypes have no influence on subroutine references like \&foo or on indirect subroutine calls like &{$subref} or $subref->().

blokhead


In reply to Re: Subroutine References by blokhead
in thread Subroutine References by Ninthwave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.