in reply to Re: Escaping the escaping escape character
in thread Escaping the escaping escape character

One thing you have to remember though is that if you're assigning \ to a string that it does interpolate in single quotes. Eg:

# uninterpolated string my $string = '\\\\ double escape \single escape'; # print it print "$string\n"; # outputs - "\\ double escape \single escape" # do your replace $string =~ s/\\/\\\\/g; # print it again print "$string\n"; # output is '\\\\ double escape \\single escape'
This can sometimes be confusing, because:
$string = '\hello'; # and $string = '\\hello';
are equivalent.

Ow, my head hurts...

cLive ;-)

Replies are listed 'Best First'.
Re: Re: Escaping the escaping escape character
by CiceroLove (Monk) on Jun 25, 2001 at 02:16 UTC
    Actually in all this, I came to the realisation tht you can do:
    $scriptSource =~ s/\\/&\#92;/g;

    You'll notice that I hadn't used the semi-colon. That worked just fine and was great. Thanks for the help though I didn't realise how wierd all that could get.


    CiceroLove
    Fates! We will know your pleasures: That we shall die, we know; 'Tis but the time, and drawing days out, that men stand upon. - Act III,I, Julius Caesar