in reply to Re: Handling multiple output files simultaneously using arrays of filehandles and filenames
in thread Handling multiple output files simultaneously using arrays of filehandles and filenames
$mydata=<INPUT>; while(<INPUT>){ #Handle data file line by line splitting it at every new line \n my(@data)=split/\n/,$_; #Now lets go through the whole input data file line by line for($i=0;$i<@data;$i++){ $mydata=$data[$i]; if($mydata=~/^Blah$some_regex(\d+)$some_more_regex_perhaps/){ #Get the sector value which is listed in each matching line of data $DataSector=$1; #Output line of matching data to output file for the relevant sector print $fh[$dataSector] "$mydata\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Handling multiple output files simultaneously using arrays of filehandles and filenames
by choroba (Archbishop) on Jan 21, 2021 at 21:22 UTC | |
Re^3: Handling multiple output files simultaneously using arrays of filehandles and filenames
by AnomalousMonk (Bishop) on Jan 21, 2021 at 23:21 UTC | |
by Cosmic37 (Acolyte) on Jan 22, 2021 at 14:01 UTC | |
by AnomalousMonk (Bishop) on Jan 22, 2021 at 19:49 UTC |