in reply to Re^2: Substitution for braces
in thread Substitution for braces

There are many other problems in the script as presented, but you immediate problem can probably be solved by changing the offending line to:

$arr[$i]=~ s/\Q$Name_pre\E/$Name/g;

True laziness is hard work

Replies are listed 'Best First'.
Re^4: Substitution for braces
by gem555 (Acolyte) on Jul 09, 2009 at 06:48 UTC
    while(my $line=<DATA>){ if($line =~ /<cc>([\s\S]+?)<\/cc>/){ #print $name_pre; my $name=$1; my $name_pre = $1; $name=~ s/&amp;amp;/&amp;/g; $name=~ s/&amp;/-/g; $name =~ s/-$//; $name_pre=~ s/\Q$name_pre\E/\Q$name\E/g; $name_pre =~ s/\\//g; } } __DATA__ fg-&amp;amp;&amp;+(and(we- <id>6VE4AGAfg-&amp;amp;&amp;+(and(we-</id><cc>fg-&amp;amp;sonia&amp;-n +d_&amp;amp;lio_(we-</cc>
    These changes doesnot reflect on the file. The replace is not done for the files. Please tell me what is the solution