Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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 search turns up Text::Extract::Word, which looks promising.

Athanasius <°(((><contra mundum


In reply to Re: Word and Excel by Athanasius
in thread Word and Excel by PerlStart

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found