I've got a tab delimited data file and having an issue.
Ok, in short, this is the problem code:
foreach $line (@file) {
($field1value, $field2value, $field3value, $field4value, $field5value,
+ $field6value, $field7value, $field8value, $field9value, $field10valu
+e) = split(/\t+/, $line);
Using the above code, if, for example, the 7th spot for information is the database is blank, it puts whatever's in the 8th spot as 7th (it shifts them to the left. If 2 fields are blank, you come up 2 fields short at the end, etc.). In the database, the tabs are there, but it appears that my split command groups multiple ones together.
I'm taking the information from the file and importing it into a mySQL database, and obviously this causes problems.
Any suggestions are greatly appreciated. Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.