Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Replacing whitespaces with a regex

by Anonymous Monk
on Mar 04, 2013 at 10:43 UTC ( [id://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+$/ / }