Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Reaplcing double spacesby ducky (Scribe) |
on Sep 23, 2001 at 02:48 UTC ( [id://114109]=note: print w/replies, xml ) | Need Help?? |
Hmmm... tr just does translating. ie, First character in the left hand list gets replaced with the first character in the right hand list, etc. Try replacing tr with s and adding "g" to the end. If you've got a variable number of spaces something like: s/ +/|/g should work. (see update II) Since it's 2 or more, use this: s/ +/|/gThat's two spaces, then a + to gobble the additional spaces. HTH -Ducky update:Gah! typos galore! =/ update II:Based on the reply, added a mo' bettah, should work kinda answer.
In Section
Seekers of Perl Wisdom
|
|