in reply to Re^3: Write to multiple files according to multiple regex
in thread Write to multiple files according to multiple regex

yes I added the $line=~
print {$filehandles[$i]} $line if $line =~ /$regex[$i]/;
I dropped the ../^END/ to play with the $/ operator. Not working yet though. Before that I had
print {$filehandles[$i]} $line if ($line =~ /$regex[$i]/../^END/);
which redundantly wrote all (correct) lines to the last (not the correct) filehandler.