?
Solved

Running multiple SUB program at the same time

Posted on 2004-04-27
4
Medium Priority
?
163 Views
Last Modified: 2010-03-04
Hi gurus


Is there a way to run multiple SUB progrmans at the same time in one PERL script ? Or do I need to make multiple PERL scripts ?

So let's asume that I have program:

----------EXSAMPLE---------------

#!/usr/bin/perl -w

use Net::FTP;

&FTP1;
&FTP2;
&FTP3;

----------END---------------


I need to run those sub scripts at the same time and I don't want to PERL ends with the firs FTP before moving to second one.


Thanks for any advise


- Jussi

0
Comment
Question by:salmjuh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:vi_srikanth
ID: 10935926
U can try threading:

use Thread;
$th1=Thread->new(\&FTP1);
$th2=Thread->new(\&FTP2);
$th3=Thread->new(\&FTP3);
$retval=$th1->join();
$retval=$th2->join();
$retval=$th3->join();
0
 
LVL 4

Expert Comment

by:vi_srikanth
ID: 10935948
0
 
LVL 3

Accepted Solution

by:
PerlKing earned 150 total points
ID: 10945826
http://search.cpan.org/~bdarrah/Proc-ParallelLoop-0.5/lib/Proc/ParallelLoop.pm

Using this module, you can write a loop like a "foreach" loop. But the good thing is that all the iterations of the loop happen parallely. You can also specify the parallelism you need.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans
Suggested Courses

762 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