- or download this
#!/usr/bin/perl
use warnings;
use strict;
- or download this
my @kids = (
sub { print "First!", $/; },
sub { print "Second!", $/; },
...
);
pipe my ($in, $out);
- or download this
my %kid;
for (@kids) {
my $cpid = fork;
...
};
$kid{$cpid} = undef;
}
- or download this
close $out or warn $!;
s/.$/??? says the child/, print while <$in>;
delete $kid{+wait} while %kid;