in reply to Re: Performance Tuning: Searching Long-Sequence Permutations
in thread Performance Tuning: Searching Long-Sequence Permutations

Never thought I'd be correcting Abigail, but this will only add 1 to $permutations total. A //g match in scalar context only ever returns 1 (or 0), no matter how many times it matches. Unfortunately, to make it work, you have to run it through an array first
$permutations_total += @array = $string =~ /$promoters_regex[$j]/g;
Which isn't very nice. Don't know how to get around that.

Jasper

Replies are listed 'Best First'.
Re: Performance Tuning: Searching Long-Sequence Permutations
by Abigail-II (Bishop) on Jun 27, 2003 at 13:23 UTC
    Eh, right, but it doesn't have to be an array. A list will do, even if it's empty:
    $permutations_total += () = $string =~ /$promoters_regex[$j]/g;

    Abigail

Re: Re: Re: Performance Tuning: Searching Long-Sequence Permutations
by diotalevi (Canon) on Jun 27, 2003 at 13:25 UTC

    Assign it to an empty list. $permutations_total += () = $string =~ /$promoters_regex[$j]/g.