# the only obfu'd part of this code would be the regex # which fails anyway so nevermind the obfu # more concerned with the behavior $str = "foobar fOObar"; $x = qr/(foo)/i; print $1 while ($str =~ m _${x}_g); print "\n"; # prints 'foofOO\n' to STDOUT - fine $str = "foobar fOObar"; $x = "(foo)"; print $1 while ($str =~ m _${x}_g); print "\n"; # prints 'foo\n' to STDOUT - also fine # this is where it gets weird # and of course the part I most badly wanted to work $str = "foobar fOObar"; $_ = qr/(foo)/i; print $1 while ($str =~ m _${_}_g); print "\n"; # throws error: # Missing right bracket at az.pl line 17, within pattern