in reply to Write to multiple files according to multiple regex
First, at the very least, to refer to elements of an array, this should be:print @filehandles[$i] if (/@regex[$i]/../^END_OF_BLOCK/);
Second, I do not really see the point of the ../^END_OF_BLOCK/ part in your context.print $filehandles[$i] if (/$regex[$i]/../^END_OF_BLOCK/);
Finally, I cannot test right now, but I don't think that:
is going to work properly. I think you probably need something like this:print $filehandles[$i] $_;
Otherwise, some of the errors that you have would be picked up by the compiler if you had used the following pragmas:print {$filehandles[$i]} $_;
at or near the top of your script file.use strict; use warnings;
|
|---|