Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Perl script from Perl script? 1

Status
Not open for further replies.

serpento

Programmer
Jun 16, 2002
92
GB
Is it possible to run a perl script from inside another perl script?

-Ed ;-)

________________________________
Destiny is not a matter of chance; it is a matter of choice.
 
If it's on the local machine, there's a variety of ways you can make system calls.
Code:
#run, wait, and continue
system("/path/to/perl/script.pl");

#like above, but stores the output
#note: backticks ` not apostrophe '
@lines = `/path/to/perl/script.pl`;

#run and exit
exec("/path/to/perl/script.pl");

#run, continue, and don't wait
fork("/path/to/perl/script.pl");
Or if you're trying to call a cgi script from another website, the LWP module is the easiest thing to use.
Code:
use LWP::Simple;
$webpage = get("[URL unfurl="true"]http://www.domain.com/cgi-bin/script.cgi");[/URL]
Probably more ways. Perl, the great TIMTOWTDI language.

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
Thanks very much. Thats just what I was looking for.

-Ed ;-)

________________________________
Destiny is not a matter of chance; it is a matter of choice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top