tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ Trouble writning an array to a text/database file

How to call one PERL script from another ▻

How to call one PERL script from another

In article <50mb28$j18@pheidippides.axion.bt.co.uk>,
Phil Clark <pclark@oldec1.agw.bt.co.uk> wrote:
>How can I call one PERL script from within another?

That all depends what you mean by "call".  To run another program (any
program, including a Perl script) then return to this one, try `system'.
To run another program without returning, try `exec'.  To run a program
and capture its output, try ```' (that's a pair of backticks, just like
you might use in one of the shells).

>Should I use EXEC? I tried various combinations to no success...

Perl's `exec', like the shells' `exec', and exec(2), overlays a new
process image over the calling process.  If the exec is successful, the
calling process "becomes" the new program, and the old program is no
longer running.

Chances are good that you want `system' instead, but since you don't
give any details...

Tim.
--
Tim Goodwin   | "USENET, of course, is a pure and unadultered source
Cambridge, UK | of truth and wisdom." -- Richard Kettlewell

Original headers:

From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl.misc,comp.infosystems.www.authoring.cgi
Subject: Re: How to call one PERL script from another
Date: 5 Sep 1996 11:33:15 GMT
Organization: UUNET PIPEX
Message-ID: <50mdpr$1qp@wave.news.pipex.net>
References: <50mb28$j18@pheidippides.axion.bt.co.uk>

△ comp.lang.perl △

◅ Trouble writning an array to a text/database file

How to call one PERL script from another ▻