Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

RE: Trying to display subcategories and counts

by Anonymous Monk
on May 05, 2000 at 09:49 UTC ( #10323=note: print w/replies, xml ) Need Help??


in reply to Trying to display subcategories and counts

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
  • Comment on RE: Trying to display subcategories and counts

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://10323]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-08-13 18:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?