|
|
| Problems? Is your data what you think it is? | |
| PerlMonks |
I Hope This Isn't A Piece of Homework....by arunhorne (Pilgrim) |
| on May 21, 2002 at 19:16 UTC ( [id://168312]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Much as this smacks of a piece of University homework, I have made a solution anyway ;) I came up with a rather cheeky solution to this. As it is possible for a company to access different files, the data structure warranted being a hash (of company names) against references another hash (of file names) for each company. However, this is a lot of effort. I opted for forming a key to a single hash out of a company name and file name (separated by a comma) and keeping a count to the occurence of each of these. Then having read the data file, when the time came to output the results, I split the hash-key on the comma to give two separate scalars...
This code expects the data provided in the question to be in the file data.tmp in the same dir as the script. It produces the following output as req'd:
Once again, I hope I haven't done ur homework for you! Arun
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||