Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2014-07-24 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (164 votes), past polls