Based on the prior reply, i was thinking about way to work through this. The prior example work great, but the last time i was doing something with data sorted and sub-sorted by fiedls, i went with the following hash-of-a-hash approach. If you do not need the other data, the hash assignment can be changed to equal "1" as oppoed to $_. Once again, this is only really nessasary if you are doing complex aggregate reporting and sorting on the data ... otherwise i would do the above, as it should be faster.
my %HASH;
while (<DATA>) {
chomp;
$HASH{substr($_,2,8)}{substr($_,12,9)} = $_;
}
foreach my $col_2_num (sort keys %HASH) {
foreach my $col_3_num (sort keys %{ $HASH{$col_2_num} }) {
print "$col_2_num : $col_3_num : '$HASH{$col_2_num}{$col_3_num
+}'\n";
}
}
- Matt-Fu (MZSanford)