$ cat names
projectname_flag_jantemp
projectname_flag_febtemp
projectname_flag_marchtemp
projectname_flag_mondaytemp
$
Perl代碼:如何在Perl中執行一般模式分配?
my $infile = "names";
open my $fpi, '<', $infile or die "$!";
while (<$fpi>) {
my $temp = # what should come here? #
func($temp);
}
我想溫度分別有
jan
feb
march
monday
。
模式始終保持不變
projectname_flag_<>temp
怎麼辦提取?
請記住檢查是否匹配成功。 – 2010-09-30 13:37:53