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