Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How can I get the four highest valued letters in an array?

by Anonymous Monk
on Jun 02, 2017 at 10:19 UTC ( [id://1191934]=note: print w/replies, xml ) Need Help??


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

    Simply garbage.


    The way forward always starts with a minimal test.

      May be

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1191934]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found