我实际上是从网站复制/粘贴代码,详细说明了如何通过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.
我确信这很简单,但我非常感谢任何帮助。
谢谢,
戴夫
答案 0 :(得分:3)
你有5个开放的parens,但只有4个关闭parens。
if ( ( ... )
and ( int(...) > 50
)
应该是
if ( ( ... )
and ( int(...) > 50 )
)