%host = (
'ip1' => {
'tcp' => {
'21' => {
'state' => 'open',
'service' => 'ftp'
},
'80' => {
'state' => 'open',
'service' => 'web'
}
}
},
'ip2' => {
'tcp' => {
'23' => {
'state' => 'open',
'service' => 'telnet'
},
'80' => {
'state' => 'open',
'service' => 'web'
}
}
}
);
####
foreach $ip (keys %host) {
print $ip . "\n";
foreach $type (keys %{$host{$ip}}) {
foreach $no (keys %{$host{$ip}->{$type}}) {
print " " . $no . "\t" . $host{$ip}->{$type}->{$no}->{'state'} . "\t" . $host{$ip}->{$type}->{$no}->{'service'} . "\n";
}
}
}
##
##
$host{'ip1'}->{'tcp'}->{53}->{'state'} = 'open';
$host{'ip1'}->{'tcp'}->{53}->{'service'} = 'dns';