要从文件中的多行句子中提取第三列,我尝试使用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
另一个'使用严格'和'使用警告'的例子会让你更接近解决方案。 –