davidj has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,
I should know how to do this, but I don't, so please forgive me. I have some text files with characters whose hex codes are 91, 92, and 97. I want to substitute these characters with other characters. How do I go about doing this? I'm guessing I need to use pack, but I'm uncertain how to do it.

As always, many thanks for your assistance,

davidj

Replies are listed 'Best First'.
Re: remove characters by hex code
by gaal (Parson) on Jan 04, 2005 at 23:21 UTC
    Your file is in an 8-bit encoding, yes? Make sure perl thinks so too, then use \x for the substitution.

    #!/usr/bin/perl -C0 # (see -C in perlrun) # [...] y/\x91\x92\x97/omg/; # or some other three replacement chars
      Thank You.

      davidj