in reply to Regex with variables

In perlop Binding Operators it states "The right argument is a search pattern, substitution, or transliteration. The left argument is what is supposed to be searched, substituted, or transliterated...".

So, you're very close, but you need to put the search pattern $test on the right side of the =~, and what is supposed to be searched $targets on the left: $targets =~ /$test/.

-stevieb