Answer the question
In order to leave comments, you need to log in
How to delete everything after the last character in a text file?
Can you please tell me how to delete everything after the last character (.) in a text file using perl?
For example, there is a file 1.txt
In it:
gkjgklgn.jmnmmm.44444.55555.66666\hyjjkjmh
total should be:
gkjgklgn.jmnmmm.44444.55555
Answer the question
In order to leave comments, you need to log in
$string = "gkjgklgn.jmnmmm.44444.55555.66666\hyjjkjmh";
print substr($string, 0, rindex($string, "."));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question