in reply to Re: sorting array of arrays
in thread sorting array of arrays
use strict; use warnings; ;; my @ar = ([1,12],[8,3],[4,57],[22,5]); my @sort = sort{$a->[1]<=>$b->[1]}@ar; foreach (@sort){ print "@$_\n";}
PS D:\perl\perlmonks> perl .\sort.pl
8 3
22 5
1 12
4 57
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sorting array of arrays
by AnomalousMonk (Archbishop) on Jan 20, 2020 at 04:43 UTC |