Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, I need to insert the character ' several times into my file but cannot find a way to escape this. Any suggestions? Thanks, Lou

Replies are listed 'Best First'.
Re: how to escape ' character
by Joost (Canon) on Feb 27, 2005 at 18:30 UTC
Re: how to escape ' character
by sh1tn (Priest) on Feb 27, 2005 at 18:27 UTC
    Please, see
    perldoc -q escape
    s/(')/\\$1/g;


Re: how to escape ' character
by jZed (Prior) on Feb 27, 2005 at 21:52 UTC
    Please show us the context for this question. In ordinary practice you don't need to escape quote marks. If this relates to a DBI query you *definitely* should not roll your own. Use $dbh->quote(), or even better, use placeholders.
Re: how to escape ' character
by ambrus (Abbot) on Feb 27, 2005 at 21:43 UTC

    Try "\47".