Hey-lo Monks,

Today I began the journey of Subroutines and I got this very weird thought in my head. I began comparing subroutines with modules. I first did a bit of research via PerlMonks and came across Simple Module Tutorial to try and understand the inner workings of modules. I could only skim over because I am not yet on that level of comprehension.

So in this, I was wondering if subroutines and modules generally work the same way within a program. I read that a subroutine can be recycled as much as you would like within a program. Is a module not used as a recyled block of code as well? So, then I looked around for a simple definition of a Module and came across this one:

"A portion of a program that carries out a specific function and may be used alone or combined with other modules of the same program." (answers.com)

I am still reading up on both as I write this, but I was hoping a few could clarify and help me see the line between subroutines and modules. Article and tutorials are greatly appreciated.
Thanks

Es gibt mehr im Leben als Bücher, weißt du. Aber nicht viel mehr. - (Die Smiths)"

In reply to Subroutines vs Modules by sub_chick

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.