![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Parsing errorby pryrt (Abbot) |
on Jan 30, 2023 at 19:15 UTC ( #11150038=note: print w/replies, xml ) | Need Help?? |
You said,
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 Section
Seekers of Perl Wisdom
|
|