in reply to searching through array for multiple patterns

If I understand the question correctly, you have a pattern and you want to determine whether or not it appears in your array as a whole rather than checking each element of the array individually, right?

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.