You're running into regular expression meta characters, like $. You want to look at perlre and use \Q...\E or quotemeta for interpreting your string as literal characters in regular expression interpolation:
my $regexp = qr/\Qsome$thing\E/; ... if (/$regexp/) {
or alternatively
my $regexp = quotemeta('some$thing'); ... if (/$regexp/) {
In reply to Re: variable interpolation in regexps
by Corion
in thread variable interpolation in regexps
by Locutus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |