in reply to Replacing multiple spaces into one character?
$str = ' xx y z '; $str =~ s/(?<=\w)\s+(?=\w)/g; #replace only spaces between letters $str=~ tr/ //d; #delete leading and trailing spaces [download]
pike