in reply to read data 1 byte at a time

I don't know if it will help you, but don't forget "unpack" for getting binary data. There are many variations:
#!/usr/bin/perl $string = 'once upon a binary bit'; foreach my $byte (unpack "C*", $string) { print "$byte\t"; } print "\n";

or

#!/usr/bin/perl use strict; use warnings; $/='undef'; my $in = shift || $0; open (ZZ, "< $in") or die $!; binmode ZZ; my $file=(<ZZ>); my @nums = (unpack "L*",$file); print "@nums\n"; close ZZ;