in reply to regex: how to negate a set of character ranges?

I think you'll have a much easier time if you decode the Shift-JIS bytes to characters, work with characters, then encode the chararacters into Shift-JIS bytes when needed. These functions are found in Encode in Perl 5.8.