Q
Q
I'm trying to use fork and have the processes interact with each
other... Is this possible? Something like:
my $pid = fork();
my $gotit = 0;
if ($pid) {
while (1) {
if $gotit = 0 {
<do a thing>
$gotit = 1;
}
}
} else {
while (1) {
my $input = <STDIN>;
print $input;
$gotit = 0; #when I get input, I want to set gotit back to 0 so
the parent starts again.
}
}
Is there a good way to accomplish this?
other... Is this possible? Something like:
my $pid = fork();
my $gotit = 0;
if ($pid) {
while (1) {
if $gotit = 0 {
<do a thing>
$gotit = 1;
}
}
} else {
while (1) {
my $input = <STDIN>;
print $input;
$gotit = 0; #when I get input, I want to set gotit back to 0 so
the parent starts again.
}
}
Is there a good way to accomplish this?