Gourab Sengupta Gourab Sengupta - 11 months ago 39
Perl Question

identifying the forward slash

Suppose I have 3 variables.

my $val1 = './f1/abc.txt'; #f1 is the folder where abc.txt resides.

my $val2 = './f1/def.txt';

my $val3 = 'gh.txt';

I am facing an issue while reading the './f1/' part.

if ($val1 =~ m/^a.*\.txt$/ or $val2 =~ m/^d.*\.txt$/) { print $val3; }

this doesn't work with the folder name. Please help.


You can find the forward slashes in "./f1/" with this escape sequence: