use strict; use warnings; my $buf; open(FILE, "image.jpg") or die "$!"; while (read(FILE, $buf, 60*57)) { print encode_base64($buf); }