in reply to Easy one for my fellow Monks

This is because the open paren has a special meaning in regular expressions -- it tells Perl that you may want to talk about whatever ends up matching between the parens later. Because you want a literal paren, you need to escape it. Try s/\(/,(/;

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Replies are listed 'Best First'.
(shockme) Re: Re: Easy one for my fellow Monks
by shockme (Chaplain) on Dec 20, 2001 at 03:14 UTC
    Q: Why wouldn't it be s/\(/,\(/; ? Don't you have to escape the second open paren as well?

    If things get any worse, I'll have to ask you to stop helping me.

      Parens are special characters to regular expressions. Only the first part of s/// is a regular expression. The replacement part is a string. Parens aren't special in strings (though $ and @ are, for example, so you'd have to escape those if you wanted a literal $ or @).

              - tye (but my friends call me "Tye")