Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Replacing whitespaces with a regex

by Anonymous Monk
on Mar 04, 2013 at 10:43 UTC ( #1021625=note: print w/ replies, xml ) Need Help??


in reply to Replacing whitespaces with a regex

Small variation of the previous solutions, replace any spaces (even 1 space) with 1 space:

for ( @array ) { s/\s+$/ / }


Comment on Re: Replacing whitespaces with a regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2015-07-31 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls