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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |