use constant TEST => 'test'; my $var = 'test'; if($var =~ qr{${\TEST}}) { print 'OK!' } else { print 'Not matched!' }