I have been trying to extract part of a file path..and so far have been unsuccessful.
I have the following:
my $verpath = \main\branch1\13
I need to extract the "branch1" from this path.
I am using the following split "formula":
my $filename1 = (split /\//, $verpath)[-1];
However this returns \main\branch1\13..instead of branch1.
The $verpath value can vary..some examples:
\main\branch1\12 - need to extract branch1
\main\branch1\sub-branch1\34 - need to extract sub-branch1
\main\intg1\branch2\branch3\45- need to extract branch3
Any help in this would be appreciated.
-Thanks
I have the following:
my $verpath = \main\branch1\13
I need to extract the "branch1" from this path.
I am using the following split "formula":
my $filename1 = (split /\//, $verpath)[-1];
However this returns \main\branch1\13..instead of branch1.
The $verpath value can vary..some examples:
\main\branch1\12 - need to extract branch1
\main\branch1\sub-branch1\34 - need to extract sub-branch1
\main\intg1\branch2\branch3\45- need to extract branch3
Any help in this would be appreciated.
-Thanks