sravs448 has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; foreach my $myfile (@myFiles) { open my $FILE, '<', $myfile or die $!; while (my $line = <$FILE>) { my ($project, $value1, $value2) = <Reg exp> ,$line; print "Project : $1 \n"; print "Value1 : $2 \n"; print "Value2 : $3 \n"; } close (FILE); }
File Content
Checking Project foobar <few more lines of text here> Good Files excluding rules: 15 - 5% Bad Files excluding rules: 270 - 95% Good Files including rules: 15 - 5% Bad Files including rules: 272 - 95% <few more lines of text here>
Desired Output
Project :foobar Value1 : Good Files excluding rules: 15 - 5% Bad Files excluding rules: 270 - 95% Value2 : Good Files including rules: 15 - 5% Bad Files including rules: 272 - 95%
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl: Regular Expression
by choroba (Cardinal) on Sep 18, 2014 at 17:08 UTC | |
|
Re: Perl: Regular Expression
by Anonymous Monk on Sep 18, 2014 at 17:05 UTC |