use strict; use warnings; local $/ = \16; binmode(STDIN); my $offset = 0; while () { my $bytes = $_; $bytes =~ s/(.)/sprintf('%02X', ord($1))/seg; $bytes = join ' ', map /.{1,8}/g, $bytes; my $chars = $_; $chars =~ s/[^[:print:]]/./g; printf("%08X: %-35s %s\n", $offset, $bytes, $chars); $offset += 16; }