Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Word and Excel

by Athanasius (Abbot)
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


Comment on Re: Word and Excel
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004277]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (16)
As of 2015-07-07 20:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls