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.
In reply to Re: Reaplcing double spaces
by wog
in thread Replacing double spaces (was: Reaplcing double spaces)
by DaWolf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |