Your skill will accomplish
what the force of many cannot
Count the Duplicate Entries and make them uniqby slayedbylucifer (Scribe)
|on Aug 29, 2012 at 11:34 UTC||Need Help??|
slayedbylucifer has asked for the
wisdom of the Perl Monks concerning the following question:
I am working on CSV and need to manipulate it as follows. Please note that these are test files I created for explanation on this thread. However the essence of the problem is the same.
I have below test.csv:
Please note that there are rows which has duplicate entries.
I want to create report.csv as follows by referring above table:
Meaning, e.g. I need to create entries for OS and RELEASE and count the times It was liked as "YES" or "NO".
So this is the flow I am following:
1. Create hash of array with "OS name" as hash value and "Array reference" to the array containing RELASE versions for that OS as the values.
2. Run a "SELECT" query by looping over this Hash and print the corresponding the RELEASE and LIKE values
3. unique/count the output received in step 2 and push it to the report.csv
I am stuck at step no. 3. I am not able to unique and count the entries which were received from step 2. I would not say that my code is not working. i would rather say I am not able to think of a way to make it work. Basically, I am not able to think of the logic how to get this done.
Sorry for the long and confusing explanation. I am pasting my code below but I am pretty sure it would add to more confusion. Also you may find lots of bugs in this code