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
In reply to Re: Regex with variables
by stevieb
in thread Regex with variables
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |