If you need to call a function in another Perl script, you must "require"
that script in your program.  You can then call the desired function.  Make
sure the script you wand to require is in the same directory or you will
have to push its directory into the @INC array.  Here is an example.



#!/usr/local/bin/perl -w

push(@INC, "/usr/home/aaa/");  # only needed if someScript.pl is not in the
@INC dir, which includes the local dir
require 'someScript.pl';

&someScriptFunction;


Daryl J. Hoyt
Performance Engineer
Geodesic Systems
312-832-2010
<http://www.geodesic.com>
<mailto:[EMAIL PROTECTED]>



-----Original Message-----
From: Chas Owens [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 9:11 AM
To: Tucker, Ernie
Cc: [EMAIL PROTECTED]
Subject: Re: question


On Tue, 2002-04-16 at 09:39, Tucker, Ernie wrote:
> How can a have one perl script call another perl script ?
>
>
> Ernest P. Tucker II
>  Network Technician
>  Charter Communications
>  Madison Management Area
>    (608) 373-7625
>

That depends on what you mean by call.  If you want to run an external
script you can use system.  If you want to run an external script and
want to use the output in your program use the backquotes (@output =
`/usr/bin/command.pl`;).  However, if you mean that you want to call a
function in another script then you need to take a look at modules
(perldoc perlmod).

--
Today is Sweetmorn the 33rd day of Discord in the YOLD 3168


Missile Address: 33:48:3.521N  84:23:34.786W


--
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