[Kc] List of Lists
jyoung79 at kc.rr.com
jyoung79 at kc.rr.com
Thu Sep 16 21:04:30 CDT 2004
Hello everyone,
I've been researching through my Perl books, etc. and can't figure out
how to create a list of lists. Here's what I'm trying to do:
I've got a text file that contains data like this:
0000,ABC,1234,X1,20040102,21.15
0025,ABC,1328,X1,20040102,15.97
0001,DEF,1000,X2,20040210,1.89
...
I'd like to create a list of lists of each paragraph from the text
file. So it would look something like this:
(("0000ABC1234", "X1", "20040102", "21.15"), ("0025ABC1328", "X1",
"20040102", "15.97"), ("0001DEF1000", "X2", "20040210", "1.89"))
(I'm going to combine the first 3 items from each paragraph into one
item (which is the Stock Number) --> (i.e. 0000, ABC, 1234 becomes
0000ABC1234).
From everything I've read so far though, it doesn't look like it's
possible to make this list of lists. The reason I'm looking into this
is because I'm going to have to match the stock numbers from this list
with another document. So for example, if my other document has a
paragraph that just contains:
0025ABC1328
then I'll want to loop through my list of lists, and if I find a
matching stock number then I'll add the appropriate data from it's list
to this other document's paragraph that contains the stock number above
(separated by tabs though):
0025ABC1328(tab)X1(tab)20040102(tab)15.97
So basically I'm attempting to create a simple automatch process.
Please let me know if anyone has any ideas that are more efficient than
this, or if you know how to create a list of lists. Thanks very much
for looking at my question.
Jay
More information about the kc
mailing list