Solved

execute another script and wait for it to finish

Posted on 2000-02-18
5
138 Views
Last Modified: 2010-03-05
Ive tried to use the
use shell;
scriptname.pl

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
0
Comment
Question by:Spearmon
5 Comments
 
LVL 19

Expert Comment

by:Kim Ryan
Comment Utility
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
&main;  
.....

and create subroutines called main etc. inside scriptname.pl. Either that or make a module.
0
 

Author Comment

by:Spearmon
Comment Utility
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
0
 

Author Comment

by:Spearmon
Comment Utility
sorry about the title i ment to say and not wait for it to finish
0
 
LVL 5

Accepted Solution

by:
amitpagarwal earned 150 total points
Comment Utility

try the following
....
system ("/usr/local/bin/perl -w script.pl") ;
...
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
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
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now