mevans has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to figure out how to pass data from one process to another. I've read perlipc but I am still missing something or misunderstood something. Would any one be able to set me straight on what I'm doing wrong?
#!/usr/bin/perl pipe(READER, WRITE); $pid =fork(); if ($pid) { print "\nIn parent"; $val1 = 100; while($num = <READER>) { print "\nin while"; print $num; } close(READER); } else { print "\nIn child"; $val2 = 150; print WRITE $val2; close(WRITE); print "\nChild closed write"; } do { $forkvar = waitpid (-1, WNOHANG); } while ($forkvar < 0);
Update:everything seems to be working now. Thanks for you assistance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: interprocess communication
by morgon (Priest) on May 15, 2014 at 15:23 UTC | |
|
Re: interprocess communication
by moritz (Cardinal) on May 15, 2014 at 17:30 UTC | |
|
Re: interprocess communication
by mr_mischief (Monsignor) on May 15, 2014 at 19:21 UTC | |
by Anonymous Monk on May 15, 2014 at 20:03 UTC | |
|
Re: interprocess communication
by kcott (Archbishop) on May 16, 2014 at 06:20 UTC |