Within single quotes "[" is not considered as a special character.
So,it's a mess trying to escape this character with backslash "\".
So,your code expects \[%one_two%\] instead of [%one_two%].




On Thu, 7 Oct 2004, Anish Kumar K. wrote:

> Hi
> 
> Please anyone help me in Reg Exp. I wanted to replace "[%one_two%]" and "[%pne%]" 
> with the value "New" say...

> #!/usr/bin/perl
> 
> $openTag='\[%';
> $closeTag='%\]';
> my $count=0;
> $_= "This is a test for [%one_two%] number and [%pne%] numbers.";
> 
> s/$openTag.*$closeTag/New/g;
> 
> print "The new line is:::::: $_ \n";
> 

-- 
Regards,   
K.Prabakar 

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