【发布时间】:2013-07-17 07:26:28
【问题描述】:
基本上我想计算包含单词 Out 的行数。
my $lc1 = 0;
open my $file, "<", "LNP_Define.cfg" or die($!);
#return [ grep m|Out|, <$file> ]; (I tried something with return to but also failed)
#$lc1++ while <$file>;
#while <$file> {$lc1++ if (the idea of the if statement is to count lines if it contains Out)
close $file;
print $lc1, "\n";
【问题讨论】:
标签: perl parameters line-count