in reply to Regex doubt

$line =~ s/TelecommuterTrac(\\)?WebIntHitList3/country/;


Update: Do substitution on both single and double quoted lines
;-)

Replies are listed 'Best First'.
Re^2: Regex doubt
by Anonymous Monk on Jul 29, 2005 at 08:36 UTC
    That will leave $line unchanged, as it will change a string consisting of TelecommuterTrac followed by a backslash, followed by WebIntHitList3 to country. But $line was assigned "TelecommuterTrac\WebIntHitList3" which does not contain a backslash. It's in double quoted context, and the backslash is escaping the W from its special meaning (which it doesn't have). So, $line equals TelecommuterTracWebIntHitList3.
      That depends - the OP may have originally been presented with a problem in which the backslash was there but is losing the backslash during the testing process to try to fix the (wrong) problem.

      One world, one people