Pandey Rajeev-A19514 wrote:

Hi ,

I have a question regarding matching strings that have embeded perl special characters.

$abc = 'MC10.G(12)3c';

$efg = 'MC10.G(12)3c';

Now I want to check whether they are same or not by doing

if ($abc =~ /$efg/) { do something;}


Why not use the 'eq' operator if ($abc eq $efg) {#do something;}


For this I need to insert a '\' before every special char.



For academic interest, you can escape the special characters during matching using \Q and \E
if ($abc =~ /\Q$efg\E/) { #do something;}



Can some one tell me an easy way to do ?


Regards
Rajeev





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to