Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Strip leading and trailing blanks

by fruiture (Curate)
on Jul 29, 2003 at 21:16 UTC ( #278995=note: print w/ replies, xml ) Need Help??


in reply to Strip leading and trailing blanks

Because this is a common problem (and _has_ been answered here before) i can tell that there is a very efficient way to do it (probably the most efficient one of the less complicated):

s/^\s+//; s/\s+$//;

See perlop and perlre.

--
http://fruiture.de


Comment on Re: Strip leading and trailing blanks
Download Code
Re: Re: Strip leading and trailing blanks
by Kanji (Parson) on Jul 29, 2003 at 22:22 UTC

    Check out trim() by japhy... a really neat sub that wraps and builds upon this very solution.

        --k.


Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-12-21 16:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls