Welcome to the Monastery | |
PerlMonks |
Re: substituting constants within regex?by halley (Prior) |
on Jul 09, 2007 at 13:46 UTC ( [id://625604]=note: print w/replies, xml ) | Need Help?? |
Nobody's mentioned that '^M' isn't the way you express a newline. It looks like you're trying to remove all those ^Ms you see in your files. Those are not really "caret character" plus "letter m character" (which is what you describe), but a special character called a carriage return that just appear that way in editors.
People who see this problem are likely using some form of Unix. You likely have a program called dos2unix on your system. Use that on your files. Barring that, here's a perl one-liner from the Unix prompt that will do the same thing.
If you really need to do this in your own code, the bit between the single quotes is useful to you. Update: From above replies, it looks like you do know the difference between '^M' and '\r', but I hope the information is still useful for yourself or others. --
In Section
Seekers of Perl Wisdom
|
|