no warnings qw(uninitialized); @{$res{'act'}} = sort { return 0 unless $a->{'act'} =~ /^move/ and $b->{'act'} =~ /^move/; return $a->{'act'} cmp $b->{'act'}; # add < delete } @{$res{'acts'}}; return \%res;