execute another script and wait for it to finish

Ive tried to use the
use shell;

this executes the scriptname.pl but ends the original script So the original does not finish running it cuts it off about in the middle every thing is kinda half done any ideas
Who is Participating?
amitpagarwalConnect With a Mentor Commented:

try the following
system ("/usr/local/bin/perl -w script.pl") ;
Kim RyanIT ConsultantCommented:
shell is used to run Unix shell commands transparently within perl. I am not sure why you would want to use it to execute one perl script from within another. You could say

# your first perl script
require "scriptname.pl";
....some code

and create subroutines called main etc. inside scriptname.pl. Either that or make a module.
SpearmonAuthor Commented:
Im trying to avoid waiting for the script that im calling to finish before the main script completes the second script is indexing about a thousand meta tags and takes about 10 minutes to run
SpearmonAuthor Commented:
sorry about the title i ment to say and not wait for it to finish
If you want the other script to run at the same time as your main script, you might say
  system"script.pl &";
see also, fork/exec
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.