【发布时间】:2019-01-14 12:49:53
【问题描述】:
我是 perl 的新手。无论如何,我试图调试自己。但我无法确定
语法错误是
Bareword found where operator expected at D:\DevelopmentLab\softwares\sc-master\sc.pl line 468, near "s%/%_%gr"
syntax error at D:\DevelopmentLab\softwares\sc-master\sc.pl line 468, near "s%/%_%gr"
Execution of D:\DevelopmentLab\softwares\sc-master\sc.pl aborted due to compilation errors.
代码是
sub getBackupFileName {
my ($containerName, $volume) = @_;
my $backupFileName = $volume =~ s%/%_%gr;
return "${containerName}_${backupFileName}.tar";
}
任何帮助将不胜感激..
【问题讨论】:
-
您使用的是哪个版本的 Perl。运行
perl -v的结果。s命令的r选项是新的。您在示例中的代码在 Perl 5.20.2 下编译 -
我使用的是 v5.12.3
标签: perl