in reply to Socketpair and a lot of children
You could make your loop more perl-ish by re-writing it as:
for(1 .. $NUM_CHLDS) { push @pids, my $pair = { child_fh => undef, parent_fh => undef, pid => undef }; socketpair($pair->{child_fh},$pair->{parent_fh}, AF_UNIX,SOCK_STREAM,PF_UNSPEC) or die "socketpair at $_: $!\n"; ..... #For Reading the @pids array, instead of for(0 .. $NUM_CHLDS) , use: foreach my $pair(@pids) { close $pair->{parent_fh}; syswrite($pair->{child_fh},$line,LINE_LEN); }
"For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken
|
|---|