use MIME::Base64 qw(encode_base64); # ... if(open(my $img, "< $bild_auswahl")) {     binmode $img; my $bild;   {      local $/ = undef;      $bild = $dbh->quote(encode_base64(<$img>));   }   close $img;   # in datenbank einfügen   my $sth = $dbh->do("UPDATE kontakte SET bild = $bild WHERE id = $ref_hash_haupt->{'id'}")|| die $DBI::errstr; } else {   die "Unable to open $bild_auswahl: $!"; } # ...