foreach $unicode (keys %from) { if (defined($to{$unicode})) { if ($from{$unicode} ne $to{$unicode}) { my $fromhex = $from{$unicode}; my $tohex = $to{$unicode}; $wrong = $wrong . '\\' . sprintf('%o', hex $fromhex); $right = $right . '\\' . sprintf('%o', hex $tohex); } } }