in reply to String substitution

Your search string is interpreted as a regular expression, and it contains regular expression meta characters. See perlre. Maybe you wanted to use quotemeta or \Q|?

$line =~ s/\Q$expr/$n_expr/;

Replies are listed 'Best First'.
Re^2: String substitution
by abhay180 (Sexton) on Jul 12, 2010 at 17:03 UTC
    Thanks a lot. That helps. Indeed i seem to have forgotten the basic rules of substitution :-)