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

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<";


Comment on Re: Trimming whitespaces methods
Download Code
Replies are listed 'Best First'.
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 <>

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2015-08-03 15:21 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (45 votes), past polls