要從文件中的多行句子中提取第三列,我嘗試使用map
和split
。我得到了良好的效果,我試圖只提取採用分體式:如何使用perl split從多行提取第三列?
#!usr/local/bin/perl
@arr=<DATA>;
foreach $m (@arr)
{
@res=split(/\s+/,$m[3]);
print "@res\n";
}
__DATA__
the time is 9.00am
the time is 10.00am
the time is 11.00am
the time is 12.00am
the time is 13.00pm
另一個'使用嚴格'和'使用警告'的例子會讓你更接近解決方案。 –