in reply to Naked quotes work like m//?
but what you got here is just a weird case of pretty much the same, and as such, works too, for some meaning of "work".$pat = 'fo.d'; $s =~ $pat
Do note that using // or "" as delimiters is not the same thing. One's a regex, the other a string. Oh, and using m with quotes as delimiter, makes it a regex again. Witness the difference:
resulting in:#! perl -w $\ = "\n"; # one line per print $s = "abc\\.def"; print $s; $s =~ /(\\.)/ and print $1; $s =~ "(\\.)" and print $1; $s =~ m"(\\.)" and print $1;
abc\.def \. . \.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Naked quotes work like m//?
by Nkuvu (Priest) on Dec 05, 2004 at 19:03 UTC | |
by bart (Canon) on Dec 05, 2004 at 19:21 UTC | |
by Nkuvu (Priest) on Dec 05, 2004 at 20:36 UTC |