|
-
Nov 20th, 2002, 03:51 PM
#1
Thread Starter
Lively Member
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
-
Dec 3rd, 2002, 03:05 PM
#2
New Member
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 "\".
-
Dec 4th, 2002, 12:45 PM
#3
Thread Starter
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|