title: Perl convert image to base64
body: <p>I am using a service to send a picture to a server and they require the image be converted to base64 format before it is sent. I tried MIME::Base64 with this code:</p>
  
  <pre><code>use MIME::Base64 ();
  
  open (IMAGE, "C:\\wamp\\www\\image.png") or die "$!";
  
  $base64_string = IMAGE;
  $encoded = encode_base64($base64_string);
  print "Encode $encoded";
  </code></pre>
  
  <p>and got this error message</p>
  
  <p><code>Undefined subroutine &amp;mqin::encode_base64 called at line 6.</code></p>