in reply to Sorting on Exists
Note that the round brackets here are necessary.my @sorted = sort { $a->{total_rate} <=> $b->{total_rate} } @array; @sorted = ( (grep { defined $_->{vtype_ug} } @sorted), (grep { not defined $_->{vtype_ug} } @sorted) );
my @sorted = map { $_->{total_rate} *= -1 if $_->{vtype_ug}; $_ } sort { $a->{total_rate} <=> $b->{total_rate} } map { $_->{total_rate} *= -1 if $_->{vtype_ug}; $_ } @array ;
|
|---|