I am not able to take care of special characters.
I have the following perl script.
while(@mapping_array[$i])
{
chomp(@mapping_array[$i]);
my @core= split ( / / , $mapping_array[$i]) ;
@core[0] =~ tr/ //ds ; ## Deleting blank spaces
@core[1] =~ tr/ //ds ;
system("perl -pi -e 's/@core[0]/@core[1]/' $testproc ");
print "@core[0] \n";
print "@core[1] \n";
$i++;
}
The issue is that my @core[0] variable could be a simple string like abc or a more complex one like TEST[1]. My script works as expected for abc, replacing it with the value of @core[1], but it failes if my @core[0] is TEST[1].
Using ? instead of / in the substitution operator doesn't help. How can I do this correctly?
$core[0].