Edward Wijaya wrote:
> Hi,
> 
> I would like to know which of this
> is better and what is the pro and cons:
> 
> 1. A file "mysub.pl" which stored
> a subroutine, and later called by
> main file using:  do "mysub.pl"
> 
> or
> 
> 2. A file "mysub.pm" and called
> in main file using : use "mysub.pm"

The second construct is not valid; the argument to "use" must be a bareword.

It's not really possible to answer your question without knowing more
details. I'm not clear about what's actually in mysub.pl. The general answer
is that "use" is the preferred method for bringing in routines, and you
should use proper module construction techniques for writing modules.

See 

   perldoc -q require

for a comparison of the various methods available to you in Perl.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to