c:\@Work\Perl\monks>perl -wMstrict -le "chomp(my $string_to_find = ); ;; my @array_to_search = qw(Foo whathiddenever Bar 12hidden456); ;; for my $s (@array_to_search) { print qq{'$s' has '$string_to_find'} if $s =~ $string_to_find; } " hidden 'whathiddenever' has 'hidden' '12hidden456' has 'hidden' #### c:\@Work\Perl\monks>perl -wMstrict -le "chomp(my $string_to_find = ); ;; my @array_to_search = qw(Foo whathi$denever Bar 12hi$den456); ;; my $rx_search = qr{ (?<= \d) \Q$string_to_find\E (?= \d) }xms; ;; for my $s (@array_to_search) { print qq{'$s' has '$string_to_find'} if $s =~ $rx_search; } " hi$den '12hi$den456' has 'hi$den'