首先,我得到dataRecord成這樣的陣列,
my @dataRecord = split(/\n/);
接下來,我在陣列的數據記錄,以獲得測試線這樣過濾,
@dataRecord = grep(/test_names/,@dataRecord);
接下來,我需要從測試線像這樣得到測試名稱,
my ($test1_name,$test2_name,$test3_name) = getTestName(@dataRecord);
sub getTestName
{
my $str = shift @_;
# testing the str for data and
print str,"\n"; # This test point works in that I see the whole test line.
$str =~ m{/^test1 (.*), test2 (.*), test3 (.)/};
print $1, "\n"; # This test point does not work.
return ($1,$2,$3);
}
有沒有更好的方法來完成這個任務?
你期待什麼樣的價值觀去取回? –