Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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 romping around the Monastery: (5)
As of 2015-12-01 03:25 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (792 votes), past polls