Re: replacing backslash

it_says_BALLS_on_your forehead wrote:
> Adam wrote:
> > Thanks for replying.. I tested that, but it doesnt give the desired
> > result, namely a output with 2 backslashes. Í've used this for
> > testing:
> >
> > $texT="This \ is my test";
> > $texT =~ s/\\/\\\\/g;
> > print $texT;
> that's because your initial string is in double quotes, and not single
> quotes. Perl is interpolating the '\ ' to mean an esaped space, which
> is essentially a space. try putting your initial string in single
> quotes.

perhaps i should have written that Perl is interpolating the "\ " to
mean an escaped space.


Relevant Pages

  • Re: How to pass string in command line argument.
    ... Perl Pra wrote: ... i have perl script that searches given string (the string should be passed ... The string should be sent to the script with double quotes attached to it ...
  • Re: How to pass string in command line argument.
    ... >>> my perl script is something like this ... >>> just a straight string is geeting passed ... >>> but i need to send the entire string including double quotes to the ...
  • Re: Comments requested: brief summary of Perl
    ... >of Perl. ... When converting a string to a number, only the characters up to the first nonnumeric ... | Assignment is done with the = sign, as seen above, and you can use an assignment statement ... Within single quotes, the only ...
  • Re: oddness in quotes (PerlMagick)
    ... I thought Perl did not differ between single and ... m> double quotes, as long as used consistently in a string. ... have you ever used interpolation in a perl ...
  • Re: What is @
    ... Only for strings inside of double quotes within a Perl script. ... Perl will look for variables in the string and replace them with the ... It will try to replace @isp with the contents of an array named @isp. ...