

sub hexdump {
    local($data)=@_;
    local($i,$byte);

    $i=0;
    while($line=substr($data,$i,16)) {
	@bytes = unpack("C16",$line . ("\0" x 16));
	print "\t";
	foreach $byte (@bytes) {
	    printf "%02x ",$byte;
	}
	print "    ";
	foreach $byte (@bytes) {
	    if($byte > 32 && $byte <126) {
		printf "%c",$byte;
	    } else {
		print ".";
	    }
	}
	print "\n";
	$i+=16;
    }
}

foreach $file (@ARGV) {
    open(F,$file);
    undef $/;
    $data=<F>;
    close(F);
    &hexdump($data);
}

