#!/usr/bin/perl -w use strict; my %HouseInformation = (); { # Set up some information for testing $HouseInformation{6}{G} = 17; # 17 houses in Town G, Street 6 $HouseInformation{6}{A} = 9; # 9 houses in Town A, Street 6 $HouseInformation{8}{E} = 2; # 2 houses in Town E, Street 8 $HouseInformation{8}{K} = 8; # 8 houses in Town K, Street 8 $HouseInformation{9}{N} = 3; # 3 houses in Town N, Street 9 $HouseInformation{4}{J} = 7; # 7 houses in Town J, Street 4 # Loop through each street and get information foreach my $street (sort keys %HouseInformation) { foreach my $town (sort keys %{$HouseInformation{$street}}) { my $houseCount = $HouseInformation{$street}{$town}; print "Town $town, Street $street has $houseCount houses.\n"; } } } exit;