Hi.

The problem is that the second part of the substitution (HI) is not
taken as a regex, but as a string, which is to mean that you're trying
to replace "\n" with "HI\n".

If you were using

s/
 (\n)
/HI/xisg;

instead, you wouldn't have that problem.


Now that we've been through the problem, let me tell you about an easier
way to do it:

s/\n/HI/g;

There :-) Much simpler, isn't it? :-)

Regards

jac



On Mon, 2004-05-03 at 10:30, Durai wrote:
> Hello All,
> 
> I am having the following lines of code to remove "\n" from string.
> 
> $_="Hi. \n This is test string";
> s/
>  (\n)
>  /HI
> /xisg;
> 
> print;
> 
> I expected the output like:
> 
> Hi. HI This is test string
> 
> But I got:
> 
> Hi. HI
>  This is test string
> 
> Anything wrong?
> 
> Regs,
> Durai.
> 
> 
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.665 / Virus Database: 428 - Release Date: 4/24/2004
-- 
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo


-- 
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