use strict; use warnings; my (@arr, $ref); while (<DATA>) { chomp; if (/^[a-zA-Z]/) { $arr[$#arr+1][0] = $_; } elsif (/^\d/) { $arr[$#arr][1]{$_}++; } } foreach (@arr) { print @$_[0] . "\n\n"; print "width height quantity\n\n"; $ref = @$_[1]; for (sort {$ref->{$b} <=> $ref->{$a} or $a cmp $b} keys %$ref) { print "$_ " . $ref->{$_} . "\n\n"; } } __DATA__ office 1 120 120 120 120 140 135 155 135 120 120 bedroom 2 100 75 100 75 120 180
In reply to Re: Data Structures Help
by TedPride
in thread Data Structures Help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |