#!/usr/bin/env perl use utf8; ############################################################################### # This program converts input stream of bytes to hexadecimal. # # Copyright © 2020 Richard Lesh. All rights reserved. ############################################################################### use Utils; use strict; use warnings; MAIN: { binmode(STDIN); my $c; my $hex; my $count = 0; while (defined($c = Utils::getbyte(*STDIN))) { if ($count % 16 == 0) { print Utils::messageFormat("\{0:06x\}:", $count); } ++$count; $hex = Utils::messageFormat(" \{0:02x\}", $c); print $hex; if ($count % 16 == 0) { print "\n"; } } }