in reply to Looping through a binary file

Or use rather the read function which will read the number of bytes you specify. For example:

open my $fh, "<", $infile or die cannot open $infile $!";; read $fh, $out, 100; # reads 100 bytes from the file

You can also use the seek function to move down the file.