in reply to How can I get the four highest valued letters in an array?

And now for something completely different...

#!/usr/bin/perl # http://perlmonks.org/?node_id=1191833 use strict; use warnings; my @x=qw/d b c e a f/; my @y=qw/4 6 5 2 9 1/; my @answer; @answer[@y] = @x; @answer = (grep defined, reverse @answer)[0..3]; print "@answer\n";