Xainin <63f2-> wrote:
> Help! I don't understand why this script:
>
> #!perl -w
>
> $a = 'C:\WINDOWS';
> $b = 'C:\WINDOWS';
>
> if ( $a =~ /^$b$/i ) {
> print "matched '$a' to '$b'\n";
> }
> else {
> print "UNMATCHED '$a' vs. '$b'\n";
> }
\W is special in a regex.
>
> $ta = quotemeta "$a";
$a is not used as a regex, it is treated as a literal string. Protecting
characters special to regexes in something not used that way is
counterproductive.
Xho
--
--------------------
http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.