#!/usr/bin/perl

my $text = 'Foo bar (baz fred) barn';

my $re = '(baz fred)';

if($text =~ /$re/) {
	print "It matched\n";			# Expected
	print "\$1 is set\n" if defined $1;	# Expected
}

if($text =~ /\Q$re\U/) {
	print "It matched again\n";		# Expected
	print "\$1 is set\n" if defined $1;	# Not expected
}
