"Shishir K. Singh" <[EMAIL PROTECTED]> writes:

> Hello, 
>
> How can I divide my perl program in different files(in other
> words..move the sub routines in different files ) and then do an
> include in the mail perl file. The reason why I want to do this is
> because my main program is growing day by day and it's becoming
> difficult to navigate through it. Is there any alternate method to
> do this?

One of the easier ways is to put all the subroutines into a file with
a .pm extension

mysubs.pm   and put it somewhere inside @INC

Then in your scripts put:

 use mysubs;

(note the extension pm is left out in the `use') but the file name
must have it.

Find out where @INC is with `perl -V'

If you have permissions put it somewhere like:

 /usr/lib/perl5/site_perl

Other wise investigate  `require' and
use lib

Something like 
`use lib "/path/to/dir";'
Then put mysubs.pm in /path/to/dir 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to