繁体   English   中英

为什么即使在我的代码中没有出现“ tr”,我仍会收到错误“音译运算符中的无效范围“ B->””?

[英]Why do I get the error 'Invalid range “ B->” in transliteration operator' even though `tr` doesn't appear in my code?

运行Perl脚本时出现以下错误:

./foo.pl第249行的音译运算符中的无效范围“ B->”

但是,第249行被注释掉了,我在代码中的任何地方都没有使用音译运算符tr

这是我脚本的相关部分。 249行是# foreach (@projects) ,如您所见,它已被注释掉。

# Find the project name, hardware, and version from the archive given
$project = undef;
$hardware = undef;
$version = undef;
if (defined $testfarmDB){
    my $idFile = `pwd`; 
    chomp $idFile;
    $idFile .= "/$ENV{TESTDIR}/testrun.id";
    y @filecontent = `cat $idFile`;
    $filecontent[0] =~ /(\d+)/;
    my $testRunID = $1;
    $hardware = $testfarmDB->getTestRunModelName($testRunID);
    $project = $testfarmDB->getTestRunProjectName2($testRunID);
    $version = $testfarmDB->getTestRunSWRevisionName($testRunID);
}else{
    die "Cannot connect to Database. Program terminated. \n";
}
print "   Project = $project\n";
print "   Model Type = $hardware\n";
print "   Software Version = $version\n";

# Break up the path given to determine the project and version number
# foreach (@projects)
# {
#     if ($archive =~ /($_)/i)
#     {
#         $project = $_;

#         foreach my $hw (@hardwares)
#         {
#             if ($archive =~ /$hw/i)
#             {
#                 $hardware = $hw;
#                 last;
#             }
#         }
#         last;
#     }
# }

 $archive =~ /((?:\d+\.)+\w+)/;
# $version = $1;

我怎样才能解决这个问题?

这个:

 y @filecontent = `cat $idFile`;

ytr运算符的古老同义词。 Perl正在搜索另外两个@字符以完成y@...@...@语句,并在您的注释部分中找到第二个字符。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM