sub genes { my ($text, $score, @genes)=@_; my $genestr=""; my $count=0; my $total=0; foreach my $gene (@genes) { $count++ while $text =~ /$gene/g; # Count number of instances if ($count) {$genestr.="$gene ";} $total+=$count*$score; $count=0; } return $total, $genestr; }