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"; } } }