Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: what is the function should I need to use for trim white spaces ?

by ikegami (Pope)
on Jan 11, 2006 at 19:22 UTC ( #522536=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    s/^\s+//g, s/\s+$//g for $value;
    
  2. or download this
    sub trim {
       local $_ = @_ ? $_[0] : $_;
    ...
    $trimmed = trim;                      # Trims $_ by default.
    @trimmed = map trim, @untrimmed;      # Trim a whole list. (readable)
    push(@trimmed, trim) for @untrimmed;  # Trim a whole list. (efficient)
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2020-05-25 15:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (146 votes). Check out past polls.

    Notices?