while (read (INFILE, $chunk, $count) == $count) { $fh = nextfile ($prefix); print $fh $chunk; }