Alan Swan wrote:
> 
> I have a script I want to run 6 instances of it simultaneously.
> So I have a calling script to loop 6 times using exec to run it.
> But my calling script always dies after the first loop.
> 
> I dun have the actaul script wit me now, but I tested
> with something like this:
> 
> Calling script:
> #!/usr/local/bin/perl
> use strict;
> 
> my ($i);
> print "TEST1\n";
> for ($i = 1; $i <= 6; $i++) {
>    print "Running script $i\n";
>    exec "perl search2.pl $i";
>    print "Ran script $i\n";
> }
> print "TEST2\n";
> 
> search2.pl:
> #!/usr/local/bin/perl
> use strict;
> 
> my $engine = shift @ARGV;
> if ($engine == 1) {
>    print "In engine 1\n";
>    #/* Some processing */#
>    print "End engine 1\n";
> }
> ### Similar if statements for 1-6.
> 
> Output:
> In engine 1
> End engine 1
> 
> Anyone has any suggestions why it stops running the other instances?
> And why the calling script doesn't print out its test statements?
> And any suggestions how to call these instances simultaneously
> (other than using fork? becos I'm not too sure how to use it...  :|)

Did you read perlfunc docs on exec?  The first sentence ought to give 
you a clue:

    The `exec()' function executes a system command *AND NEVER
    RETURNS* - use `system()' instead of `exec()' if you want it to
    return. 

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.wgn.net/~dbe/
  / ) /--<  o // //      Mailto:[EMAIL PROTECTED]   http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to