我需要在Perl代码中改变什么的想法?
perl -wc产量:
elseif should be elsif at cgitelnet-mod.pl line 410.
syntax error at cgitelnet-mod.pl line 411, near ")
{"
syntax error at cgitelnet-mod.pl line 444, near "else"
syntax error at cgitelnet-mod.pl line 453, near "}"
Illegal declaration of subroutine main::PrintDownloadLinkPage at cgitelnet-mod.pl line 461.
Run Code Online (Sandbox Code Playgroud)
整个文件可以在这里找到:http: //pastebin.com/7r5pfW5y
任何帮助是极大的赞赏!
以下正则表达式用于确认传入其中的输入是否包含字符串'ping'
elsif($RunCommand =~ m/^\s*ping\s+(.+)/)
Run Code Online (Sandbox Code Playgroud)
现在我想确认传递的输入是否包含管道命令
以下似乎没有正常工作:
elsif($RunCommand =~ m/^\s*|\s+(.+)/)
Run Code Online (Sandbox Code Playgroud)
对于上下文,我有以下if,elseif子例程.我刚刚在其顶部添加了5个语句,用于检查&或; 或<或>或|.但它没有正常工作......现在它总是去&PrintPageHeaderBC("c"); 并且包含ping,nslookup等(可接受的命令)的尝试现在不能执行它们应该执行的操作.我认为问题必须是我添加的5个正则表达不匹配和输入的文本包含&或; 或<或>或|.有帮助吗?我确信我所做的5个单独的陈述(可能是错误的)也可以合并为一个陈述.
# First discard command attempts that contain & ; < > |, then acceptable commands are executed, then final else to non-functional command
if($RunCommand =~ m/^\s*&\s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
}
elsif($RunCommand =~ m/^\s*;\s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
}
elsif($RunCommand =~ m/^\s*<\s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
}
elsif($RunCommand =~ …Run Code Online (Sandbox Code Playgroud)