in reply to Re: Forked pipe deadlock
in thread Forked pipe deadlock

for (my $i = 3; $i >= 0; $i--) { close($handles[$i]); }

In Perl, I'd prefer something like this instead of the C style for loop (YMMV of course):

close $handles[$_] for reverse 0..3;

(the explicit reverse emphasizes that it's essential here to do something in reverse order of how you'd do it normally)