in reply to searching through array for multiple patterns

Another potential solution (if I understand the problem) is to use the any function from List::MoreUtils. You should benchmark it against other solutions for your actual data to determine which is most optimal.
use strict; use warnings; use List::MoreUtils qw(any); my @commands = ( 'chicks with bricks come', 'chicks with blocks come', 'chicks with bricks and blocks and clocks come' ); if (any { /clock/ } @commands) { print "Found pattern\n"; } else { print "Did not find pattern\n"; } __END__ Found pattern