#!/usr/bin/perl -w use strict; my $file = shift || exit; my $col = 0; my $row = 0; my $byte; open FILE, $file or die $!; while (read FILE, $byte, 1) { print ( ($row*4), "\t") if ($col ==0); print unpack("B8", $byte) . "\t"; $col++; if ($col >= 4) { print "\n"; $col = 0; $row++; } } print "\n";