Note that we don't run into problems until we start introducing prototypes, which generally people say to "stay away from", which is fine, but with caveats...
Well... that's what prototypes are meant for: breaking the rules, and that entails you're taking the risk of confusing the users of your library, the perl parser, or both.
I don't think this is a satisfactory summary of what prototypes are for. The way I would put it is that prototypes are included to let any programmer write something that behaves like one of the perl built-ins
rather than a "normal" subroutine. They're there so
that you can write things that work like
$card = pop_random(@deck)
that deals from the middle of the deck instead of the top the way pop would.
As far as the main question is concerned, I can really only
think of a couple of things to say, and they're pretty obvious. When there's always more than one way to do it,
it's incumbant on the user of a subroutine to check the
documentation, looking for examples of how to use it in the
SYNOPSIS. And it's incumbant on the
original programmer to document the code, and make sure there's a SYNOPSIS with decent examples in it.
If by some strange unheard of quirk of misfortune you're working with an undocumented code base, there's always the
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.