You can run an nmap scan and have the parser parse the information automagically. The only thing is that you cannot use '-oX', '-oN', or '-oG' as one of your arguments for the nmap command line options passed to parsescan().
use Nmap::Parser;
my $np = new Nmap::Parser;
#this is a simple example (no input checking done)
my @hosts = @ARGV; #Get hosts from stdin
#runs the nmap command with hosts and parses it at the same time
$np->parsescan('nmap','-sS O -p 1-1023',@hosts);
for my $host ($np->get_host_objects()){
#$host is an Nmap::Parser::Host object
print $host->hostname."\n";
}
|