With substr()
:
substr($string, 0, -7);
I suggest you read the Perldoc page on substr()
(which I linked to above) before just copying and pasting this into your code. It does what you asked, but substr()
is a very useful and versatile function, and I suggest you understand everything you can use it for (by reading the documentation).
Also, in the future, please consider Googling your question (or, in the case of Perl, looking it up on Perldoc) before asking it here. You can find great resources on things like this without having to ask questions here. Not to put down your question, but it's pretty simple, and I think if you tried, you could find the answer on your own.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…