> > "Boon Chong Ang" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > ismsg03.altera.priv.altera.com... > Hi, > Just say i have a variable being assigned as follow, > > $a = abc/edf/a > > i want it to search from another file for the file that contains > exactly the same words, what i do is to modify the variable a become > $a = abc\/edf\/a and then > print if /$a/; but it failed > even if i tried print if "/$a/"; it also failed. Can anyone point out > my mistake or show me the correct way to do this? > >
I'm not sure what your problem is here. Even without the escape characters this works fine. Can you tell us more of what you're doing, and why you think it doesn't work? Rob use strict; use warnings; my $a = 'abc/edf/a'; while (<DATA>) { print if /$a/; } __DATA__ abc/edf/a acb/ecf/a ffabc/edf/a dsa/bc/edf/a abc/edf/agg OUTPUT abc/edf/a ffabc/edf/a abc/edf/agg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]