----- Original Message -----
From: ""Chris Charley"" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: <beginners@perl.org>
Sent: Thursday, September 13, 2007 11:55 PM
Subject: Re: working with 3-dimensional array
----- Original Message -----
From: "Tim McGeary" <[EMAIL PROTECTED]>
Hi all,
I'm trying to read in two file sets of library records, compare a regex
that I find in different lines of each set of records, and then copy one
whole line over to the other when a match is found.
?
To do this, I am trying to use a 3-dimensional array:
[fileset][record][line]
I think that I am reading and pushing the arrays onto the other arrays
correctly, but when I'm traversing the arrays to do the conditionals, I
am getting uninitialized value warnings, which seems like I'm either not
traversing correctly OR I'm not really pushing the data onto the arrays
properly.
This is my whole script below. Does anyone see what I'm doing wrong?
Thanks,
Tim
Hi Tim
It would be helpful if you could post about 15 lines from each file so we
could see what kind of data you're parsing.
Also, how many lines in the diss.flat file could have a field value of
.001. ? Are there more than 1?
Same thing for ludiss.flat. In addition, is there more than 1 line with a
field of ..856. ?
Reading your code, it seems you bail out after finding the (fisrt?) match
but if there are more lines with these values , what about them?
Perhaps if you tried to explain what you are trying to do again , then a
solution could be found.
I found a problem with your arrays, but even before you start thinking
about what kind of data structure you want to use here, a clearer idea of
whats in the file and how you want to process it could precede your choice
of arrays (or perhaps a hash).
Chris
Me again :-)
Don't know if my reply was critical - dicn't mean it to be. But, following
your code through the if blocks made me wonder and raise those questions. I
guess what I saw there was something like this:
Read the 2 files into 2 arrays.
Then, for each line of the one file, go through all the lines of the second
file until a match was found.
Then, exit the either the inner loop or outer loop and start again with the
next line from the first file looking for another match. For the second
file, you look for either a .001. or .856. field in the same line and it
can't be both. so I'm wondering what the code is supposed to do.
Anyhow, I guess I'm not sure what it is the plan to look for matches.
If you want to compare groups of lines in one file (delimited by the lines:
'*** DOCUMENT BOUNDARY ***' and 'FORM=MARC'). Is it important to group these
lines into a record delimited by those lines?
With some additional questions,
Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/