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

Hello, you can also use the very same array and cut it assigning to $#array_name special variable.

I dont know if is or not considered a best practice but it works..

A semplified example will show you what I mean

perl -e "@orig=qw(A p B e C r D l);@orig=sort{ord($a)<=>ord($b)}@orig; +$#orig=3;print join ' ',@orig" A B C D

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: How can I get the four highest valued letters in an array?
by supriyoch_2008 (Monk) on Jun 01, 2017 at 14:56 UTC

    Hi Discipulus,

    Thank you for your suggestions.

    With regards,