Thanks to everyone, it works. 

-----Original Message-----
From: Chris Rogers [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 4:58 PM
To: Shishir K. Singh; [EMAIL PROTECTED]
Subject: RE: Divide Perl script


Just create a separate file to hold your "library" routines.  You may name
the file anything you like.  Be sure to put the line:

#!/usr/bin/perl

at the top of the file (changing it to match where your version of perl is
installed).  I also put a:

1;

on the next line to keep perl from bombing out(this may not be necessary for
you but it was for me).  Then just put all your subroutines in the new file:

sub MySub
{
...(code here)
}
sub MySub2{
{
...(code here)
}

The last step is to put a "require" statement in your perl program so that
it knows where to find the "library" or subroutines.  This line looks like
this:

require '/var/www/cgi-bin/lib/filename';

Of course you will need to change the above line to match your directory
structure and filename.  That's all there is to it.  Hope this helps.

Chris


-----Original Message-----
From: Shishir K. Singh [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 4:47 PM
To: [EMAIL PROTECTED]
Subject: Divide Perl script


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?

TIA
Shishir

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

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

Reply via email to