DAN0207 has asked for the wisdom of the Perl Monks concerning the following question:
I have a input file with contents as below:
<mt>llbreserve_Stov1</mt> <mt>llbreserve_Stov2</mt> <mt>preserve_Stov1</mt> <mt>qreserve_Stov1</mt> <mt>qreserve_Stov2</mt> <mt>mnreserve_Stov1</mt> <mt>slmreserve_Stov1</mt> <mt>slmreserve_Stov2</mt> <mt>envreserve_Stov1</mt> <mt>envreserve_Stov2</mt> <mv> <value>MT=DUOSQ2,Eb=43789,Fc=67890</value> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> </mv>
I have written the code(pasting here only the specific code,not all lines)as below:
# Writing output from mt step until mv for reserve meas only $dimens=scalar(keys(%ind)); for ($jj=1; $jj <= $dimens; $jj++) { # Writing output mt reserve meas list print OUTFILE "<mt>$kpi[$jj]<\/mt>\n"; } foreach $value (keys %result) { foreach $ext (keys %{$result{$value}}) { print OUTFILE "<mv>\n"; print OUTFILE "$value".",resv="."$ext<\/va +lue>\n"; for ($jk=1; $jk <= $dimens; $jk++) { # Writing output r meas list result so +rted in the same order than mt list print OUTFILE "$result{$value}{$ext}{$ +kpi[$jk]}\n"; } print OUTFILE "<\/mv>\n"; } } print OUTFILE "$line\n";
The output file which i get after executing the code is
<mt>llbreserve</mt> <mt>preserve</mt> <mt>qreserve</mt> <mt>mnreserve</mt> <mt>slmreserve</mt> <mt>envreserve</mt> <mv> <value>MT=DUOSQ2,Eb=43789,Fc=67890,resv=Stov1</value> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> <r>0</r> </mv> <mv> <value>MT=DUOSQ2,Eb=43789,Fc=67890,resv=Stov2</value> <r>0</r> <r>0</r> <r>0</r> <r>0</r>
I can see that there are some blank lines where the combination is not present(Stov1 is present for all meas whereas Stov2 is not present for all.)I am planning to insert a tag like <r></r> in place of blank lines so that further processing of my outputfile is valid. Could you pl. help me to achieve this.TIA
|
---|