in reply to shrinking the path

To be honest, I stopped using regexp's for this a while ago. I use substr now:

if ($folder_path =~ /^$sourcedir/) { $folder_path = File::Spec->catdir('Eitv9',substr($folder_path, lengt +h $source_dir)); }
That said, if you want to use regexp's for this, you don't need the "if":
$folder_path =~ s/^\Q$sourcedir/Eitv9/;
That's because "if" it doesn't match, the substitution will fail (silently - no error message), and $folder_path will be left alone.