Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Word and Excel

by Athanasius (Chancellor)
on Nov 17, 2012 at 02:20 UTC ( #1004277=note: print w/replies, xml ) Need Help??

in reply to Word and Excel

Hello PerlStart, and welcome to the Monastery!

open('FILE',$srs) or die $1; while(<FILE>)

Let’s assume for the moment that $srs is a text file. Here are some things to consider:

  • 'FILE' is a string, but FILE is a typeglob, which is a different entity. Remove the quotes from around FILE in the open statement.
  • $1 contains the first capture from the last successful pattern match. I think you meant $!, which contains the last system error.
  • It’s better practice to use lexical filehandles and the 3-argument form of open:
    open(my $FILE, '<', $srs) or die $!;

But $srs is not a text file, it’s Word file, so you can’t read it this way at all! You need a suitable CPAN module. Not my area of expertise, but a quick CPAN search turns up Text::Extract::Word, which looks promising.

Athanasius <°(((><contra mundum

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004277]
and the pool shimmers...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-05-21 23:08 GMT
Find Nodes?
    Voting Booth?