I have the following string ./test
and I want to replace it with test
so, I wrote the following in perl:
my $t =~ s/^.//;
however, that replaces ./test with /test
can anyone please suggest how I fix it so I get rid of the / too. thanks!
I have the following string ./test and I want to replace it with test
Share
You need to escape the dot and the slash.
The substitution is
s/match/replace/. If you erase, it’ss/match//. You want to match “starts with a dot and a slash”, and that’s^\.\/.