use Win32::OLE; use Win32::OLE::Enum; print "Name of Word document: ";# input the document name along with the location chomp ($doc = ); # This is to create document object $document = Win32::OLE -> GetObject("$doc"); #steps used to convert the Word document in to a text file. print "Name of upload file: "; chomp ($upload = ) ; open (FH,">$upload"); print "Extracting Text ...$document \n"; $paragraphs = $document->Paragraphs(); $enumerate = new Win32::OLE::Enum($paragraphs); while(defined($paragraph = $enumerate->Next())) { # $style = $paragraph->{Style}->{NameLocal}; # print FH "+$style\n"; $text = $paragraph->{Range}->{Text}; $text =~ s/[\n\r]//g; $text =~ s/\x0b/\n/g; print FH "=$text\n"; } # Steps used to parse the text file and get the required information in comma seperated values open (FH,"<$upload"); while () { chomp; if (m/Test Script Name/) { $test_case_name = ; chomp $test_case_name; $test_case_name =~ s/\=//; } if (m/Script Description/) { $short_desc = ; chomp $short_desc; $short_desc =~ s/\=//; print "$test_case_name,$short_desc\n"; } } close FH;