in reply to Script exponentially slower as number of files to process increases

New theory: the fork is failing with EAGAIN or ERESTARTNOINTR.
To prove fork is not failing, add the following line immediately before the open my $IN, '<', $infile or exit(0); line.

defined $pid or die "fork failed $!";