# !perl use strict; use warnings; my $dataxml = 'z:\tla\scripts\emmaparser\index.xml'; my $xmlfile; open($xmlfile,'<',$dataxml) or die $!; while(my $line = <$xmlfile>) { if(my ($test, $test1, $test2, $test3)=$line=~m!<\s*coverage\s+type="(block)\s*,\s*\%\s*"\s+value="(\d+)\%\s+\(([\d\.]+)/([\d\.]+)\)"\s*/>!s) { print sprintf("%s %s %s xxx ",$test1,$test2,$test3); last if $test eq 'line' } if(my ($type, $value1, $value2, $value3)=$line=~m!<\s*coverage\s+type="(line)\s*,\s*\%\s*"\s+value="(\d+)\%\s+\(([\d\.]+)/([\d\.]+)\)"\s*/>!s) { print sprintf("%s %s %s xxx ",$value1,$value2,$value3); last if $type eq 'line' } } close ($xmlfile);