The stupid question is the question not asked | |
PerlMonks |
Re: use of constants in regex substitutions?by edan (Curate) |
on Sep 23, 2003 at 11:27 UTC ( [id://293461]=note: print w/replies, xml ) | Need Help?? |
This is not doing what you want it to. The backslash is interpreted when perl parses the double-quoted string, so the values end up being '.mif' and '.tif' (since \. has no special meaning in a double-quoted string, as does, say \n). Your regexp will then match any character followed by txt. You need to either:
I personally recommend #2, since you want to match literal text, without metacharacters, and that's what \Q is for. Also, you should follow Zaxo's advice, and not dmitri's, since one will work, and one won't (you guess which is which). --3dan
In Section
Seekers of Perl Wisdom
|
|