in reply to Re: speeding up regex
in thread speeding up regex
Here's the subroutine that's doing all the work.
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: speeding up regex
by BrowserUk (Patriarch) on Jul 18, 2003 at 10:30 UTC | |
|
Re: speeding up regex
by Abigail-II (Bishop) on Jul 18, 2003 at 10:37 UTC | |
|
Compile the regex
by arunp (Initiate) on Jul 18, 2003 at 10:55 UTC | |
by dbwiz (Curate) on Jul 18, 2003 at 15:20 UTC | |
by Abigail-II (Bishop) on Jul 18, 2003 at 11:12 UTC |