开发者

help with regex in perl

Can someone help me get the correct regex for this string?

Total                       14,928  3,967

I am trying to remove that line using this, but no luck:

shift @lines if $li开发者_如何学Cnes[0] =~ /^Total/;

Its also the last line of the output file.


What you might consider instead is:

@lines = grep !/^Total/, @lines;

If it is always the last line:

splice @lines, -1, 1 if $lines[-1] =~ /^Total/;

-1 is the last element in the array.

Or, more simply, as ikegami pointed out:

pop @lines if $lines[-1] =~ /^Total/;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜