I have a directory with umpteen files in it. (One file for each day of the year going back to 1997)
Each file has umpteen lines in it.
Each line has a | delimited list in it. (The pipe was the one character that didn't seem to be used in the files)
I need to be able to open the files (no problem),
process each line (no problem)
and assign a variable to each bit of info within the | delimited list (problem).
These vars will then be used to populate a database.
I was thinking the best way would be to stuff each line into an array then use that to create the vars. After going through the array info in my Perl books and the Q&A on arrays on this site, now I'm not so sure.
If an array is the way to go, I have been unable to separate the info in each line at the |.
Split doesn't do it since that only seems to separate on whitespace and I *definitely* don't want to do that.
I also checked out the 'files' and 'strings' section with no enlightenment.
I know this *has* to be a simple thing to do but I just can't seem to do it. Can any of you point me in the right direction? I would definitely appreciate the help.
Thanks,
Susan
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.