in reply to interprocess communication
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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: interprocess communication
by Anonymous Monk on May 15, 2014 at 20:03 UTC |