Using fork to execute parallel child processes

Posted on 2004-11-28
Last Modified: 2006-11-17
Hello all

I am new to Perl and am trying to experiment with its management of UNIX processes.  What I am trying to do is, as a parent, execute 2 child processes that communicate with each other via a pipe (I am executing these processes using fork).  the child processes are simply going to be small bourne shell scripts.  the standard input of the first process needs to be the standard input of the Parent, the standard output needs to be the pipe to the second process.  the standard input of the second process needs to be the pipe of the first process and the standard output needs to be the standard output defined in the Parent  Any assistance offered will be greatly appreciated.

Question by:joeltillman
    LVL 18

    Expert Comment

    Have a look at IPC. Specifically the Open2 function is what you're looking for.
    LVL 18

    Accepted Solution

    another helpful module is IO::Pipe.

    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

    On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
    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…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now