I want to write a Perl script that encodes a file using Base 64 encoding. The Perl documentation tells you to do this:

Code:
use MIME::Base64 qw(encode_base64);
open(FILE, "/var/log/wtmp") or die "$!";
while (read(FILE, $buf, 60*57))
{
      print encode_base64($buf);
}
but it only seems to encode the first part of the file and then returns. I was wonderring if anyone else has done something like this before, and if so how you got it to work.

Thanks in advance!