@sorted = sort { exists $b->{vtype_ug} <=> exists $a->{vtype_ug} } sort { $a->{total_rate} <=> $b->{total_rate} } @arr;