Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: remove first and last character of string

by syphilis (Archbishop)
on Oct 14, 2020 at 10:46 UTC ( [id://11122824]=note: print w/replies, xml ) Need Help??


in reply to Re^3: remove first and last character of string
in thread remove first and last character of string

$s = substr $s, 1, -1;

Nice.
I didn't know that would work. I would have done it as:
$s = substr $s, 1, length($s) - 2;
But I've read the documentation, now ;-)

Cheers,
Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122824]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found