use Data::HexDump; my $f = new Data::HexDump; $f->file("file"); $f->block_size(1024); print while $_ = $f->dump;