in reply to searching through array for multiple patterns
grep can do that:
if (grep(/clock/, @commands_run)) { print "\n Test -- found pattern -- \n"; } else { print "\n Test -- did not find pattern -- \n"; }
While this is the easiest way to do this, you may want to benchmark it against si_lence and skirnir's solution to see which is faster for your dataset. grep is more highly optimized in its searching, but it will continue on to find all matches in the array rather than aborting after finding the first.
|
|---|