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