Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:10:08+00:00 2026-05-29T12:10:08+00:00

Currently in my Perl script I make a call like the following: system( ./long_program1

  • 0

Currently in my Perl script I make a call like the following:

system(" ./long_program1 & ./long_program2 & ./long_program3 & wait ");

I would like to be able to log when each of the long running commands executes while still executing them asyncronously. I know that the system call causes perl to make a fork, so is something like this possible? Could this be replaced by multiple perl fork() and exec() calls?

Please help me find a better solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:10:09+00:00Added an answer on May 29, 2026 at 12:10 pm

    Yes, definitely. You can fork off a child process for each of the programs to be executed.

    You can either do system() or exec() after forking, depending on how much processing you want your Perl code to do after the system call finishes (since exec() is very similar in functionality to system(); exit $rc;)

    foreach my $i (1, 2, 3) {
        my $pid = fork();
        if ($pid==0) { # child
            exec("./long_program$i");
            die "Exec $i failed: $!\n";
        } elsif (!defined $pid) {
            warn "Fork $i failed: $!\n";
        }
    }
    
    1 while wait() >= 0;
    

    Please note that if you need to do a lot of forks, you are better off controlling them via Parallel::ForkManager instead of doing forking by hand.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our continuous integration system currently runs a perl script to parse our sln/proj files
I currently have a Perl script that runs an external command on the system,
I would like to call other Perl scripts in order to perform a contention
Currently I have a perl script that runs forever on my server, checking a
I'm currently working on a Perl script to gather data from the QuakeLive website.
I am currently developping a multi-environment perl script. As you all know, environment configuration
I currently have a perl script that imports HTML and converts it to plain
I'm trying to write a perl script that determines which users are currently logged
I'm new to Perl, currently writing a Perl script to automatically fill web forms
We are currently introducing DBIx::Class in our team and we would like to start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.