Hello Monks, I am interested in finding out how to get this specific subroutine to work.
I have worked it out using other method but very interested in finding the method to this specific hash format below since I couldn't find the solution myself
Since I couldn't fix it myself and still interested to see to see how you guys do it
sub routine must find the MODE in a given set of numbers. must find the most duplicated number and pass the value.
data 2 3 3 3 5 7 8 12 32 44 55 12 3 23 43 33 1 4 25 43 42 1 4 5 3 3 3sub mode_num{ my %count=(); %opt = %{shift @_ } ; #creating hash #dump \%opt; #check data coming in.. #need to get integrate count as I format data into hash(next task + to make it reable) for (sort{$a <=> $b} %opt{NUMBERS}){ #dump \$opt{NUMBERS}++; $opt{NUMBERS}++; } our @keys= sort{$opt{NUMBERS}->{$b}<=>$opt{NUMBERS}->{$a}} key +s %opt{NUMBERS}; return }
In reply to Help fixing this piece of code by perlynewby
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |