in reply to Replacing double spaces (was: Reaplcing double spaces)
my $str = "apple banana lemon"; $str =~ tr/ /|/s; print "$str\n"; # apple|banana|lemon
The /s option to tr is needed to do this. It will make tr "squash" repeated characters generated by transliteration to just one character.
|
|---|