I need to understand how stuff works otherwise I'll soon be asking the same things again and annoy you all.

AnonyMonk has given a pretty good explanation above, but you need to understand where to look stuff up. That way, you'll be able to answer your own questions when the time comes that everyone else is too busy or too annoyed to answer them for you.

... I thought Perl reads the script line by line from top to bottom. Now in this example we first use make_path and then set the subroutine. Shouldn't the subroutine be on top of everything else?

In Perl, a subroutine can, in most cases, be defined anywhere in the program and at any time (compile- or run-time) just as long as it is defined when it is actually called at runtime (see perlintro and perlsub). The only examples I can think of that require prior definition or declaration of a function involve prototypes — but don't involve yourself with prototypes unless you have to; see Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen.


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: make_path for creating directory tree by AnomalousMonk
in thread make_path for creating directory tree by fasoli

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.