On Sunday 04 Oct 2009 17:53:24 Mike Flannigan wrote: > I want to change character code 160 to character > code 32 throughout a bunch of text files. I'm using > this right now > s/(.)/ord($1) == '160' ? chr(32) : $1 /eg; > and it works, but I don't like it much. If anybody > has another way they like better, I'd appreciate > seeing it. It does not have to be a reg exp. > > Anybody know why this doesn't work? > tr/\160/\32/d; > Oddly it replaces 'p' (character code 80) with > character code 26??? >
Well, Shawn gave you the correct answer, I'll just explain why it didn't work for you. The reason it doesn't is because \DDD uses octal digits - not decimal ones: http://en.wikipedia.org/wiki/Octal Regards, Shlomi Fish > I get the digest version, so may not respond > right away. > > > Mike Flannigan > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Freecell Solver - http://fc-solve.berlios.de/ Chuck Norris read the entire English Wikipedia in 24 hours. Twice. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/