Please clarify your question, preferably by providing an example of the data and your code to process it. | [reply] |
jrsimmon, thank you for the response.
I would get the data i expected and then in between I would get a "Use of uninitialized value $key in print at multiline.pl line 22, <PF> line 1." and then it would continue and spit out some more data, and then the error inbetween.
I am not sure what causes the error message. But now I simply do a check if my variable eq "" and if so skip to the next, and then I get rid of the error.
I wanted to put pairs of into into a hash, but when I tried doing that I would get the Odd number of elements error .. But now I could finally succesfully make the hash.
I did not have any blank lines in the data file, so what caused the uninitialized value error? I dont know, but adding blank lines would increase the error message. Well - Life as a novice perl codr is not always easy. TA
OK, a quick update just to describe how I did it.
- Read a complete text file into a scalar
- Split on 0 so we get multiline "blocks" of text and put them into an
+ array
- Go through each element in the list and split it up further into fou
+r blocks.
- The fourth block is what we want. Split it up on \n to get each indi
+vidual line into an array.
- Go through each element (line), check is it empty (eq "") then skip
+to the next
- Finally do our last split, on where we get a "descriptor" and a "des
+cribed"
- Add them to a hash as key/value pair.
Voila :) Only thing that doesnt fit is why would I sometime get an undefined value? regards, ta | [reply] [d/l] |
| [reply] |