tej has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I am using Text::Extract::Word to extract data from doc file. However whatever i do I can get only last sentence of this file

My code looks like:

use Text::Extract::Word; my $file = Text::Extract::Word->new("try.doc"); my $raw = $file->get_text(':raw'); print "$raw\n";

If my doc file has following data:

Hello

Welcome to Perl

When i rum my script I get only "Welcome to perl" as output

What can be wrong in the script

I am using ms office 2003 and perl version 5.12.2

Replies are listed 'Best First'.
Re: Problem in Text::Extract::Word
by Khen1950fx (Canon) on Sep 23, 2011 at 07:59 UTC
    get_text seems to cut-off the first line, so use get_body(':raw') instead.
    #!/usr/bin/perl use strict; use warnings; use Text::Extract::Word; use Data::Dumper::Concise; my $file = '/root/Desktop/test2.doc'; my $extractor = Text::Extract::Word->new($file); my $string = $extractor->get_body(':raw'); print Dumper($string);