use warnings; use strict; use Win32::OLE; my $word = CreateObject Win32::OLE 'Word.Application' or die $!; $word->{'Visible'} = 0; my $document = $word->Documents->Add; my $selection = $word->Selection; $selection -> TypeText("Hello World"); $selection -> TypeParagraph; $selection -> TypeText("How do you feel today"); $selection -> TypeParagraph; $selection -> TypeText("Some header"); $selection -> {'Style'} = "Heading 1"; $selection -> TypeParagraph; ' $document->SaveAs('c:\generated.doc'); ## uncomment the following two if word should shut down $document->Close; $word->quit;