### WRONG ### while () { open OUT, ">outfile_" .$i++; if ( m/^\$\n$/ ) { ### CORRECT ### open OUT, ">outfile_" .$i++; while () { if ( m/^\$\n$/ ) {