use strict; use warnings; my $ndata = '35312c38'; my $ndataxor = 0; for my $num (map { hex($_) } split //, $ndata) { print "$ndataxor xor $num -> "; $ndataxor ^= $num; print "$ndataxor\n"; }