Dec 29, 2000, 7:35 PM
Post #1 of 2
I have created a small script that reads a programmer specified flat file and creates 2 multi-dimensional arrays. I am calling the subroutine as:
passing multidim. arrays out of functions
(@fields, @contents) = flatfile_to_table("databases/myflatfile.dat");
...however when the result is returned, everything that was multi-dimensioned is now single dimensioned.
The subroutine creates an array and using the split operation, divides the data into a multi-dimensional array called @contents. Afterwards and within the same subroutine, I call push to move the first set of data out into another array called @fields (since the first line in a flat file table will contain the field names). This works beautifully. I can traverse all the cells in a row/col fashion (within the subroutine). However, when I do my
return (@fields, @contents)
...and try to work the returned arrays in the main body of my script, the results are single dimensioned arrays.
This has got to be a syntax problem on my part, right? Any ideas?
P.S. Before I shoot myself in th e foot there has to be a free flat file programmer perl lib, right? If you know of one, let me know!
(This post was edited by S_Shrum on Dec 29, 2000, 6:39 PM)