use MIME::Base64 qw(encode_base64); if (open (INHOUD, "$regel")) { binmode INHOUD; $bufsize = 60*57; print << "EOT1"; MIME-Version: 1.0 Content-Type: text; boundary="_----------=_10167391557129230" --_----------=_10167391557129230 Content-Transfer-Encoding: base64 Content-Type: application/msword; filename="bw051122.doc" EOT1 while ($bufsize == 60*57) { read (INHOUD, $buffer, $bufsize); print encode_base64($buffer); }; close (INHOUD); print <<"EOT6"; --_----------=_10167391557129230-- EOT6 }