develooper Front page | perl.beginners | Postings from October 2009

Change character code 160 to 32

Thread Next
From:
Mike Flannigan
Date:
October 4, 2009 07:48
Subject:
Change character code 160 to 32
Message ID:
4AC8C4F4.8000500@att.net

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???

I get the digest version, so may not respond
right away.


Mike Flannigan


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About