我正在尝试重新格式化 MySQL 的日期。这个 Perl one-liner 给了我下面的错误信息。
我想了解它为什么会给出此错误消息。
echo 'Dec 2 04:08:40 EST 2012' | perl -lane ' my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
( $amon, $mday, $hour,$tz, $year) =split('\s+',$_);
for (my $i = 0; $i < @abbr; $i++) {
next unless $abbr[$i] =~ /^$amon/;
$mon=$i;
}
$mon++;
print "$year-$mon-$mday $hour";
'
错误信息
syntax error at -e line 3, near ") {"
(Might be a runaway multi-line ++ string starting on line 2)
syntax error at -e line 9, near ";}"
Execution of -e aborted due to compilation errors.