Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Trimming whitespaces methods

by prasadbabu (Prior)
on Jun 30, 2008 at 12:41 UTC ( #694733=note: print w/ replies, xml ) Need Help??


in reply to Trimming whitespaces methods

Hi harishnuti,

Here is one way, you can use String::Util module to trim leading and trailing spaces in neat way. You do similarly for array elements. TIMTOWTDI

use String::Util ':all'; $val = ' abc '; # "crunch" whitespace and remove leading/trailing whitespace $val = crunch($val); # remove leading/trailing whitespace $val = trim($val); print ">$val<";

Prasad


Comment on Re: Trimming whitespaces methods
Download Code
Re^2: Trimming whitespaces methods
by rovf (Priest) on Jul 01, 2008 at 10:10 UTC
    Another CPAN module for trimming would be Text::Trim.
    -- 
    Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2014-09-21 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls