my $wdFormatText = 2; # wdFormatText constant from Win32::OLE::Const 'Microsoft Word' sub convert_doc_to_text { my ( $infile, $outfile ) = @_; require Win32::OLE; my $word = Win32::OLE->new( 'Word.Application', sub {$_[0]->Quit;} ); error("Can't create new instance or Word Reason:$Win32::OLE::LastError")unless $word; $word->{visible} = 0; my $doc = $word->{Documents}->Open($infile); error("Can't open $infile, Reason:$Win32::OLE::LastError")unless $doc; # wdFormatDocument wdFormatText wdFormatHTML $doc->SaveAs( { FileName => $outfile, FileFormat => $wdFormatText } ); $doc->Close; undef $doc; undef $word; } sub error { die shift }