This looks very promising, however, don't you mean every child writes to A instead of B? (because it seems like you are closing B and then reading from A). Am I misinterpretting your code somehow?
A pipe links two Filehandles thus: What you syswrite into B can you read in A
(or the other way around, I haven't the doku handy). Think of it
as a pipe (Name says it all). On a water pipe you don't fill the tap
to get water out of it, you use the other end. BTW the code was for the parent.