$file is not read because you never open it.
In reply to Re: reading files in binary mode by wolfger in thread reading files in binary mode by Anonymous Monk