-
Easy Perl Question
I am new to Perl and I'm finding out I'm pretty bad with manipulating text :)
Anyways, I have a string like this that I retrieved from our CVS log:
\\corpfiler1\Unix\u\srcroot\acapi\src/winioctl.h
and I need to put all the slashes the same way and cut off the file name, so I need in a different variable, something that looks like this...
\\corpfiler1\Unix\u\srcroot\acapi\src\
How can I do that?
Thanks in advance,
Jacob438
-
Using reguar expression if varName contains the log entry...
varName =~ s/\\/\//;
That will change the slash in your example the right way. This is the most cryptic part of Perl. After that you simply look for the last occurance of a "\" character. Then substring out from position 0 to the position of the last "\".
-
cool thanks! Yeah, perl seems to get quite cryptic with this kind of stuff and sometimes it is confusing to look at, but that advice pointed me in the right direction, thanks!
Jacob438