use MIME::Base64 qw(encode_base64); open(FILE, "1.jpg") or die "$!"; binmode FILE; while (read(FILE, $buf, 60*57)) { print encode_base64($buf); }