On Nov 15, David Inglis said:

>I have a some code that will be used in a number of my scripts, I know
>that if I have  a sub in a script I can call that piece of code as many
>times as required from the same script but how do I make this sub
>vailable to other scripts I have written.  I imagine that I create a
>seperate script with this code and somehow include this or call it.

You can include another file's source code into a program with the
'require' function:

  require "path/to/file.pl";

Just make sure the last line of the file is

  1;

The reason is that Perl needs a true value to be returned from the file to
signal that it was compiled properly.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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

Reply via email to