Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

RE: strip multiple spaces

by autark (Friar)
on Aug 01, 2000 at 05:23 UTC ( #25382=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $line = "foo  bar";
    print ++$i, ". $_\n" for split / /, $line;
    
  2. or download this
    split /\s+/, $line
  3. or download this
    $line = "  foo   bar  ";
  4. or download this
    split " ", $line
  5. or download this
    perl -MO=Deparse -e 'split " "'
    split(/\s+/, $_, 0);
    
  6. or download this
    perl -MO=Deparse -e 'split /\s+/'
    split(/\s+/, $_, 0);
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2021-03-07 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (119 votes). Check out past polls.

    Notices?