in reply to Re^2: Binary conditionals
in thread Binary conditionals

Always start your scripts with
use strict; use warnings;

It catches many of your errors. The correct comparison is either $byte eq "\x00" or $byte eq chr(0x00).

You can still use a substitution if your mapping is constant:

my %table = ( "\x00" => "\x17", "\x17" => "\x00", ... ); my $re = join '|', map quotemeta, keys %table; # open in and out files... # and then substitute: $str =~ s/($re)/$table{$1}/g

Replies are listed 'Best First'.
Re^4: Binary conditionals
by bunnym4n (Novice) on Sep 30, 2008 at 18:53 UTC
    That worked perfectly! Thank you!