in reply to Easy one for my fellow Monks

You must escape parens and these \, |, [, {, ^, $, *, +, ?, . $input =~ s/\(/,\)/; remember to use a /g at the end to match multiple times on one line.

Replies are listed 'Best First'.
Re: Re: Easy one for my fellow Monks
by grep (Monsignor) on Dec 20, 2001 at 07:29 UTC
    If you are doing several metachars you can also use \Q to quote your metachars.

    $var =~ s#\Q(#,(#;
    or
    $var =~ s#\Q([]\E#/meta/;


    /Q will quote all the metachars it sees in a regex until \E.