
stuckinarut
User
Jul 28, 2014, 4:53 AM
Post #15 of 15
(5718 views)
|
Re: [Laurent_R] Extracting duplicates and ordering by occurences
[In reply to]
|
Can't Post
|
|
OK, sorry I could not complete earlier, I was in the train to get to work on a mobile device, I had to stop when my train arrived at its final stop. For the sorting, simply try this: foreach my $value (sort {$C_list{$b} <=> $C_list{$a} || $a cmp $b } keys %C_list) { # ... The way it works is as follows: it compares numerically the values or numbers of occurrences ( the "$C_list{$b} <=> $C_list{$a}" part), and, if the values are equal, it compares the keys alphabetically. Ohhhhhhh, Laurent, THANK YOU VERY MUCH for another very Educational Experience !!! I have learned several new things here. I'm back up on a few hours of sleep and think part of a previous error was that I had not fully commented OUT a line of code that didn't work. At 70 years old, my eyesight is not the best ;-( When I finally decided to copy & join the bottom section of the code that did partially work from my basic ground-up little Hash Test to the full front end $C_list section, I learned more about Hashes and that the less lines of code the better without a bunch of # lines. Also, to especially look for any "curly braces" issues trying to hide from me. Your "explanation" of the final code snippet solution was extremely helpful to understand HOW it works !!! So you travel to work on a train! As a youth, I was fascinated by trains, and had an elaborate model train set. Then later as teenager, I traveled ~ 2,000 miles round trip by train several Summers to visit relatives. But there were no computers, no cell phones, no tablets and no Internet back then. Times have changed !!! Thank you again. Now to analyze a lot of Clist.txt file duplicates. Regards, -stuckinarut
|