我实际上是从一个网站复制/粘贴代码,该网站详细介绍了如何通过Perl与Cisco Ironport API进行交互。下面是我的代码:
#!/usr/bin/perl
use Cisco::IronPort;
$username=$ARGV[0];chomp $username;
$password=$ARGV[1];chomp $password;
$server="prodironport1-mgt.abc.com:83";
$server2="prodironport2-mgt.abc.com:83";
my $ironport = Cisco::IronPort->new(
username => $username,
password => $password,
server => $server
);
my %stats = $ironport->incoming_mail_details_current_hour;
foreach my $domain (keys %stats) {
if ( ( $stats{$domain}{total_attempted} > 50 )
and ( int (($stats{$domain}{spam_detected}/$stats{$domain}{total_attempted})*100) > 50
)
{
print "Domain $domain sent "
. $stats{$domain}{total_attempted}
. " messages, "
. $stats{$domain}{spam_detected}
. " were marked as spam.\n"
}
}
下面是我得到的错误:
syntax error at ./Ironport5.pl line 21, near ") {"
syntax error at ./Ironport5.pl line 24, near "}"
Execution of ./Ironport5.pl aborted due to compilation errors.
我相信这是很简单的事情,但我非常感谢任何人的帮助。
谢谢,
戴夫
发布于 2014-04-16 23:17:48
你有5个开括号,但只有4个闭括号。
if ( ( ... )
and ( int(...) > 50
)
应该是
if ( ( ... )
and ( int(...) > 50 )
)
https://stackoverflow.com/questions/23113484
复制相似问题