foreach( @protein) { if (...) { ... } elsif (...) { ... } ... }; #### my %count; foreach( @protein ) { $count{ $_ }++; ... };