파일 배열이 있습니다. 텍스트 몇 줄의 각 파일은, 그 중 펄에서perl : 파일을 읽는 중 Regex
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);
}
* 파일 내용을 정규식을 통해 몇 가지 특정 문자열을 얻기 위해 노력하고 있어요 *
Checking Project foobar
<few more lines of text here>
Good Files excluding rules: 15 - 5%
Bad Files excluding rules: 270 - 95%
<one more line of text here>
Good Files including rules: 15 - 5%
Bad Files including rules: 272 - 95%
<few more lines of text here>
* 원하는 출력 *
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%
'내 $ 파일 '<', $ myfile을이 $ 죽을;'$의 myfile'와'die''사이'or' 누락을 엽니 다!. –
@JimDavis 감사합니다. 업데이트 됨 – Jill448
이 줄은 '좋음/나쁨 제외', '좋음/나쁨 포함'또는 순서가 맞지 않고 인터레이스 된 것처럼 엄격한 순서로 표시됩니까? 또한 Perl을 많이 사용하지 못했습니다.이 ', $ line'이 새로운 구조입니까? –
sln