I am trying to cut down the number of ports printed in this list:
A.B.C.D 80,280,443,515,631,7627,9100,14000
to the ones that are most interesting for me:
A.B.C.D 80,515,9100
To do this, I am using this bit of code:
foreach (@ips_sorted) {
print "$_\t";
my $hostz = $np->get_host($_);
my $port = 0;
my $output = 0;
$port = $hostz->tcp_ports('open');
if ($port == 80 || $port == 445 || $port == 515 || $port == 9100) {
$output = join ',' ,$port;
}
print $output;
print "\n";
}
I probably don't need to say, that it's not working. I get this:
A.B.C.D 0
Use of uninitialized value $port in numeric eq (==) at parse-nmap-xml.pl line **(line with if).