Think about Loose Coupling | |
PerlMonks |
Help with Regular Expressionsby FFSparky (Acolyte) |
on Apr 10, 2012 at 18:25 UTC ( [id://964383]=perlquestion: print w/replies, xml ) | Need Help?? |
FFSparky has asked for the wisdom of the Perl Monks concerning the following question: Oh wise ones, I have 2 string variables (these will be dynamic) containing file system paths. As labeled one string ($BasePath) will contain the base / root path and the other string ($CurrentPath) will be the current path as the script is scanning the file system starting from the base path. What I am after is a string containing just the subdirectory without the base / root path. Using the working example I have provided the result is what I am after \DirD\DirE However, I am rather weak with regular expressions thus to me my solution seems to be rough and naturally only deals with the dreaded windows paths. I am hoping there may be a more efficient alternative that could be dynamic and also support unix paths.
Thanks in advance.
Back to
Seekers of Perl Wisdom
|
|