in reply to Re^6: reading a JSON object
in thread reading a JSON object

Hello anautismobserver,

didnt read the whole thread but for this specific question, as you started learning perl as I've done, consider the following

use strict; use warnings; use Data::Dumper; my @AoA = ( [qw(0 Just 0)], [qw(0 Another 0)], [qw(0 Perl 0)], [qw(0 Hacker 0)], ); # see it # print Dumper \@AoA; my @sortedAoA = sort{ $a->[1] cmp $b->[1] # or reverse it comparing $b to $a instead # $b->[1] cmp $a->[1] # or use reverse function to the final array.. } @AoA; # see it # print Dumper \@sortedAoA; # then to just take first X elements use a slice for my $ar_jentry ( @sortedAoA[2..3] ){ print "$ar_jentry->[1]\n" } # output: # Just # Perl # there are other options... # you create a temporary list using sort and then use only first two e +lements with ()[0,1] print "$_->[1]\n" for ( sort{$a->[1] cmp $b->[1]} @AoA )[0,1]; # output: # Another # Hacker

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.