in reply to Re^3: Write to multiple files according to multiple regex
in thread Write to multiple files according to multiple regex
thanks. how would that look like?
I did something like this
foreach(@inputs) { #localize the file glob, so FILE is unique to # the inner loop. local *FILE; local *OUTFILE; #NEW $file = "$FindBin::Bin/../rxo/$_"; $outfile = "$FindBin::Bin/../blocks/$_"; open(*FILE, "$file") || die; open(*OUTFILE, "> $outfile") || die; #NEW: added a star #push the typeglobe to the end of the array $fh = \*FILE; $ofh = \*OUTFILE; $regex = <$fh>; push(@regex,$regex); push(@filehandles,$ofh); }
this results in a new error "print() on unopened filehandle OUTFILE"
|
|---|