use strict; use warnings; use Data::Dump qw(dump); #my @t = ( {'b','1','w','10'},{'b','3','w','30'},{'b','2','w','40'}); # at first, making hash readable as such my @t = ( {'b' => '1','w' => '10'},{'b' => '3','w' =>'30'},{'b' => '2','w' => '40'}); # consider issue: the value in key 'b' is numeric, use spaceship '<=>' for compare # transform by Randal Schwartz @t = map{$_->[0]} sort{$a->[1] <=> $b->[1]} map{ [$_, $_->{b}] }@t; print dump \@t;