|Problems? Is your data what you think it is?|
Re: Out of memory error!!!by McA (Priest)
|on Mar 27, 2013 at 22:05 UTC||Need Help??|
Should be followed immediately with
You mix up several ways to open a file. You should take consistently the three parameter form. Also use scalars as file handles. So your
As stated by davido, you should iterate line by line over the file:
Every $line2 will have a LF at the end. Probably you want to get rid of it. In this case it's not necessary.
It seems you're working on fixed column format files (COBOL output?). The format of the row (line) is defined by the first two bytes (segment). So, instead of creating a big if-elsif-else-tree it would be more maintainable to create a dispatcher based on the segment. The usage of unpack may be your friend to extract the data easily. So I propose the following:
At the end you have to close the filehandles and not the 'filenames':
These proposals reflect only my personal opinion. Hopefully a little bit helpful.