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

Re: trim() magic

by dragonchild (Archbishop)
on Mar 30, 2005 at 14:21 UTC ( #443464=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub trim {
      if (defined my $w = wantarray) {
    ...
        for (@_ ? @_ : $_) { s/^\s+//, s/\s+$// if $_ }
      }
    }
    
  2. or download this
    cmpthese( -1, {
            japhy => sub { $_ = '  asdf  '; trim1(); },
    ...
              Rate dchild  japhy
    dchild 39628/s     --    -3%
    japhy  40959/s     3%     --
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://443464]
help
Chatterbox?
[beech]: erix: you'd think so but there comes a time when being polite to a "pedantic bully" is just not fun anymore
[Your Mother]: I like it when you’re polite to me though. :P

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2017-01-17 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (159 votes). Check out past polls.