in reply to Quick question on regex

Your problem is elsewhere. The . was not removed by that regexp. Or maybe you're not using strict (bad!) and really did forget to put the quotes around YYYYMMDD_something.xyz.
my $filename = 'YYYYMMDD_something.xyz'; my $DATE = '20061124'; $filename =~ s/YYYYMMDD/$DATE/i; print($filename, "\n"); # 20061124_something.xyz

Replies are listed 'Best First'.
Re^2: Quick question on regex
by Melly (Chaplain) on Nov 24, 2006 at 23:27 UTC

    ...and yet another v. good reason to always use strict. I wouldn't normally mention it, but it seems a bit more insidious than the normal misspelt variable...

    BTW OP, you've probably realised, but, in that context, the "." is interpreted as a string concatenation character.

    Tom Melly, tom@tomandlu.co.uk
Re^2: Quick question on regex
by narashima (Beadle) on Nov 24, 2006 at 17:54 UTC
    correct thanks!