# to_base64.pl use MIME::Base64 qw(encode_base64); open (IMAGE, $ARGV[0]) || die "$!"; binmode(IMAGE); local $/; my $file_contents = ; close IMAGE; open (B64, ">$ARGV[0].b64") || die $!; print B64 encode_base64($file_contents); close B64; print "output file is $ARGV[0].b64\n";