# sorts each feature by its primary tag into a hash # of array references named %sorted_features my %sorted_features; for my $f (@features) { #get cds, primer_bind, and genes features only my $tag = $f->primary_tag; # create a hash of $f keys and $tag values push @{$sorted_features{$tag}},$f; }