I'm not sure what you are asking. Do you want to know what you can do in Perl? What other people do do in Perl? Why something that makes sense isn't done more often at your workplace?

I do whatever is most convenient and also keeps my variables close to the methods/functions/subroutines that use them. This is true whether I program in C or in Perl. Both languages provide file-wide scoped variables and thus result in similar programming patterns. In both Perl and C I use files to group cooperating functions and I use files to group together reusable units. I don't think I'm particularly unusual in this regard.

In C programs one often groups cooperating functions together in a file so that variables shared by those functions, but not meant for general use by the whole application, stay nicely bundled together. In Perl one does the same thing. The only difference is the lingo. In Perl you declare a variable with file wide scope as a my variable outside of any function. In C you define it as a static variable outside of any function definition.

Also whether in C or Perl, routines that are likely to be reused as a group will be placed in a single file. In C this makes building libraries easier. In Perl it makes for fewer use statements at the top of consumer modules.


In reply to Re: Can we have C-style Modularity? by ELISHEVA
in thread Can we have C-style Modularity? by sumeetgrover

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.