Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You said,
open(FH, "<", "SRC185.xlsx" ) or die; ... while (<FH>){ chomp; ...

An XLSX is a binary file. You cannot just read it line-by-line as if it was newline-separated text and assume you're going to get meaningful data. To read through the rows of SRC185.xlsx, I recommend using the Spreadsheet::Read module -- its documentation shows examples of how to use it to read the various cells of your input spreadsheet. (And even if it were a text-based CSV file instead of XLSX, which is newline-separated text, you would have to somehow split the cells apart to become multiple individual pieces of data; and splitting CSV manually is A Bad Idea, so using Spreadsheet::Read or Text::CSV would have been the better choice for parsing even SRC185.csv.)

Also, the Anonymous Monk had good information in these posts.

addenda: BTW: kudos on use strict and use warnings -- however, since you are opening files, I highly recommend meanful error messages: saying open(...) or die; is not a helpful message; using open(...) or die "SRC185.xlsx: $!" is better; but if you 'use autodie; as well, then you don't even need to manually die with a self-crafted error message, so you can just open(...) and be done with it.


In reply to Re: Parsing error by pryrt
in thread Parsing error by MoodyDreams999

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 musing on the Monastery: (4)
As of 2024-04-24 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found