http://qs321.pair.com?node_id=10250


in reply to Trying to display subcategories and counts

Try this:
while(<FLATFILE>) { @stuff = split(/|/, $_); push(@cats, $stuff[0]); ## Do other stuff with @cats or @stuff, and then: $subcat{$stuff[1]}++; } ## This creates a hash (%subcat) in which the keys are the subcategori +es, ## and the values are the total of each one. ## So, to output a pretty list: for $x (sort keys %subcat) { print "$x ($subcat{$x})\n"; }

This will display them in alphabetical order. From the looks of your data, this is probably desired.