in reply to Data Structures Help

(untested)
my %windows; my $current_location; while (<>) { # read from stdin chomp; if ( /^\d+\s+\d+/ ) { $current_location or die "bad input"; $windows{$current_location}{$_}++; } else { $current_location = $_; } } for my $location ( sort keys %windows ) { print "\n$location\nwidth height quantity\n"; for my $dimensions { sort keys %{ $windows{$location} } ) { print "$dimensions $windows{$location}{$dimensions}\n"; } }
But /me smells homework.