我需要使用正则表达式从以下行中提取第4个字段值(128).
( '29/11/2010 09:38:05', '41297', '29/11/2010 09:40:30', '128', '17', 'SUCCESS', '30', 'e', '9843171457', '1', '-1')
Run Code Online (Sandbox Code Playgroud)
请告诉我取第4个值的方法.
提前致谢.
使用Text::CSVCPAN:
my $input = "( '29/11/2010 09:38:05', '41297', '29/11/2010 09:40:30', '128', '17', 'SUCCESS', '30', 'e', '9843171457', '1', '-1')";
my $csv = Text::CSV->new({
quote_char => "'",
always_quote => 1,
allow_whitespace => 1,
});
$csv->parse($input);
my @columns = $csv->fields();
print $columns[3], "\n"; # 128
Run Code Online (Sandbox Code Playgroud)