Gday,
I hope this helps a little:
My unerstanding is this: as you go through the file,
count each occurrence of the subcategory and when you
finish, display numbers for each subcategory.
My example assumes stdin (so you can check it out on
your file before you put it in a cgi...
while(<>)
{
($categ, $subcat, $therest) = split(/|/, $_, 3);
$subcatcount{$subcat}++;
}
foreach $subcategory (sort keys(%subcatcount))
{
print "$subcategory contains $subcatcount{$subcategory}\n";
}
...should do what you want.
Regards,
Pat Heuvel
pheuvel@optusnet.com.au