There's no backslash in your string, which is why it doesn't find one. If you use warnings (as you should, especially as a beginner), it gives you a clue:
$ perl -wE 'say "C:\username\Sources"' Unrecognized escape \S passed through at -e line 1. C:SernameSources
The \ in the double-quoted strings have a special meaning. Use double backslash to in ""-literals to produce a backslash in the string.
In reply to Re: search for '\' in perl
by moritz
in thread search for '\' in perl
by kumeperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |