Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How do I remove whitespace at the beginning or end of my string?

by gridlock (Novice)
on Feb 21, 2004 at 08:50 UTC ( [id://330778]=note: print w/replies, xml ) Need Help??


in reply to How do I remove whitespace at the beginning or end of my string?

You want to do a

s/^\s+//

followed by a

s/\s+$//

Replies are listed 'Best First'.
Re: Answer: How do I remove whitespace at the beginning or end of my string?
by PERLscienceman (Curate) on Feb 21, 2004 at 12:57 UTC
    ...or... more simply, you could do it this way as a one liner:
    s/^\s+|\s+$//g

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-18 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found