in reply to Regex from a variable...

When interpolating a variable into a RE, watch for special chars! Always use \Q...\E to get around that. This has bit me more than once.
$dataline =~ /\Q$variable\E/

Replies are listed 'Best First'.
Re: Re: Regex from a variable...
by Anonymous Monk on Jun 18, 2001 at 22:28 UTC
    Overzealous use of an idiom is so wrong as not using it. In this instance he wanted the special chars stay special chars. So don't do this!