@hashes = sort { $b->{flag} <=> $a->{flag} || $a->{name} cmp $b->{name} } @hashes;