in reply to Re: and or statement
in thread and or statement

  1. Agree heartily with previous respondents, ikegami and AnomalousMonk: Your intent is unclear.
  2. Your sample data (which sometimes makes our crystal balls more useful) is missing.
  3. ...and, further re ikegami's solution:

If your $element = "WEED BECAUSE PIPES KILLD THE PIES WITHOUT DIAL. PIPES ARE NOT GOOD FOR PIES.";

his multi-regex solution will tolerate use of /g, and -- with the addition of this code,

if (@matches) { for ( @matches ) { say $_; } }

-- will produce this output:

WEED DIAL PIES PIES KILLD

Replies are listed 'Best First'.
Re^3: and or statement
by endsin1m (Initiate) on Nov 08, 2011 at 01:14 UTC
    I like it yes that will work nicely. Sorry it was just a module of a larger piece to find motifs in a fasta formatted data set containing multiple fasta sequences from a file which I input as asked. I parsed the fasta sequence w/ a foreach loop and after each is parsed it runs this (match) part of the loop on the sequence data to discover whether the sequence contains the motifs or patterns. I only need one match per pattern, but have multiple patterns and require ID of each match case (ie only return pies once despite the number of occurrences; if pies and weed is found multiple times return both, but only once to indicate presence.