I will agree with Joost except that you also need to become used to print and similar functions.
print SPECIAL_ARG ordinary_arg_list, with_commas;
This is the only unusual construction that you need to get used to early on. Otherwise arguments are separated by commas.

Generally, just don't use the ampersand prefix and just don't use prototypes.

Regarding predeclaration or definition, use use strict and use warnings and let perl train you.

Your question is a good one and well worth better answers than you are apt to get. The problem is that your question embraces many aspects of Perl syntax and there is no short definitive answer.

There is a lot of sense in Perl. I think you just need to grapple with her for a while and you will get her big picture. Attack smaller bits of your problem and use a more empirical method to learn. Perl is one of the more grown computer languages, versus spec'd; practice is a bigger part of learning due to this.

Knowing the precedence of op's, what defines a list, and what is happening with context; knowing those will help with the issues you ask about.

Be well.


In reply to Re: Subroutine Bewilderment by rir
in thread Subroutine Bewilderment by dimar

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.