in reply to How can I get the four highest valued letters in an array?
To keep it simple:
@letters = ("d","b","c","e","a","f"); @getallen = (4,6,5,2,9,1); $teller = 0; foreach $letter(@letters){ $hash{$letter}=$getallen[$teller]; $teller++; } @keyz = keys(%hash); @sorted= reverse sort(@keyz); @highest = @sorted[0..3]; foreach(@highest){ print "$_:"; print $hash{$_}; print "\n";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I get the four highest valued letters in an array?
by 1nickt (Canon) on Jun 02, 2017 at 11:49 UTC | |
by Anonymous Monk on Jun 02, 2017 at 12:04 UTC |