{ open(my $FILE, "file.binary") or die $!; binmode($FILE); while (read($FILE, my $byte, 1)) { ... } close $FILE; }