Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: Trying to display subcategories and counts

by Anonymous Monk
on May 05, 2000 at 09:49 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found