http://www.perlmonks.org?node_id=477289


in reply to Pull all text from msword document

#!/bin/perl5 use strict; use warnings; use Win32::OLE; my $w = Win32::OLE->GetActiveObject('Word.Application'); my $d = $w->ActiveDocument; my $paras = $d->Paragraphs; my @word; foreach my $para (in $paras) { my $text = $para->Range->{text}; chop $text; # remove /r push @word, $text; } print "$_\n" for @word;