in reply to Parsing output from Nmap::Scanner with varying hash address.

As stevieb points out, the results you get back are objects, and they in turn contain other objects. The docs are a bit scattered, but the result objects are either a list with a get_next() method, or they represent a host, port, service etc. and have relevant access methods. From the code you posted I think this should achieve the same thing (untested):
my $results = $scanner->scan(); my $host_list = $results->get_host_list; while ( my $host = $host_list->get_next ) { my $port_list = $host->get_tcp_port_list; my %report; while ( my $number = $port_list->get_next ) { my $port = $host->get_tcp_port( $number ); $report{ $port->service->name } = $port->state; } }

Replies are listed 'Best First'.
Re^2: Parsing output from Nmap::Scanner with varying hash address.
by stevieb (Canon) on Jul 12, 2015 at 13:33 UTC

    There are a lot of great replies in this thread, but this is exactly what I was hoping for, I just didn't have the time on Friday evening to do the actual digging. This is great and I'm glad you posted this.

Re^2: Parsing output from Nmap::Scanner with varying hash address.
by Laurent_R (Canon) on Jul 12, 2015 at 14:37 UTC
    ++ tangent. I had been briefly looking for such access methods in the documentation, but did not find them. I probably failed to look at the right place/level in the class hierarchy. Using accessors when the exists is of course a much better way to access the contents of objects.