That depends on the requirements and flexibility you want to impose when working with subroutines, The different ways you can declare subroutines in Perl are a combination of what you have read in these books, and generally, to brief it:

As the term "prototype" suggests, you can tell Perl of the type and number of arguments you wanna pass to this subroutine and whether any of these types can be optional, therefore, it is a mechanism to make sure that you don't pass an array to a subroutine when it expects a scalar...

sub SUBNAME($@;\%)
This subroutine above is called with a scalar, list and followed by an optional hash...

You can call a subroutine in a number of ways too, but for simplicity I'd only mention two ways:
&SUBNAME # & dereferencer is implicit and can be dropped at times. #OR... SUBNAME()
How does this come in context with declaring prototypes?... using the & form of calling a subroutine would deactivate prototype checking that means, as long as you don't preface the subroutine names with & the prototypes provided in the declaration would affect/interfere with the calls to the subroutine...

NOTE: I learnt this from The Perl Black Book...

Update: ikegami and BrowserUk, I am happy to have erred and I am happy to have been guided, I was under the impression that prototypes could help validating a subroutine passed arguments, and just verifying this I did not get a proof of concept that such a behavior exists but this left me confused on what I read reviewing the lessons and with a question of "why use them prototypes after all if they are not good at checking functions or are ignored upon such validation?" , I really hope I am not being a dumb now...


Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.

In reply to Re: What's the better Perl style? Define parameters or not? by biohisham
in thread What's the better Perl style? Define parameters or not? by pureHeart

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.