in reply to Escaping confusion in RE...

You're missing an \\ escape at $1\Data. Try:
use warnings; use strict; my $a = 'L:\\Data\\5555\\'; $a =~ s#l:\\Data\\([0-9]*)\\#D:\\Sites\\$1\\Data\\#i; print $a;
recent perls with warnings and strict enabled would have given you a warning:
Unrecognized escape \D passed through at FILENAME line NUMBER.