The carrot is a special char, so if you want that to be included as a
carrot and not a "start of string" marker, it too would have to be
escaped.

To do the replace that you wanted, I'd do the following.

I have a text string = "^0176  ^0176"

$_=s/\^0176\ \ \^0176/\^0176\ \ /;

This will substitute your exact string of ^0176<space><space>^0176 with
the exact string ^0176<space><space>

If you're not keeping your trailing spaces, make sure your not chomping
or chopping your variable later in your script.

-Mike

-----Original Message-----
From: Bowen, Bruce [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 13, 2006 10:45 AM
To: Michael Gargiullo
Subject: RE: substitution

It did but the suggestion did not work.  They had me placing \ in front
of the ^.

I'll try this also.

TX,
Bruce

-----Original Message-----
From: Michael Gargiullo [mailto:[EMAIL PROTECTED]
Sent: Monday, February 13, 2006 10:35 AM
To: Bowen, Bruce
Subject: RE: substitution


This has probably been answered, but you need to escape your spaces
...  "^0176\ \ "

-Mike

-----Original Message-----
From: Bowen, Bruce [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 12, 2006 4:32 PM
To: beginners@perl.org
Subject: substitution

I have a text string = "^0176  ^0176"

I have set $a = "^0176  ^0176";
I have set $b = "^0176  ";

I'm using text =~ s/$a/$b/g;

And the text string doesn't change.  I expected it to come out as "^0176
" after the substitution.  What is wrong with my logic?

Bruce Bowen
401-568-8315




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to