use constant FOO => 'bar'; my $x = FOO; $x = qr/$x/; "somehting" =~ $x