DrJones
04-19-2003, 10:41 PM
I'm writing a perl script that reads in some info from a file and stores the info into an array. The problem is I have several files (all are the same format), and I don't know how many (it's a command line arg). I can't for the life of me figure out how to do it. If i knew there would be 10 or whatever i could just hard code it. In C++ I would just use a 2 dimensional array being array[filenumber][itemnumber], but in perl i can't figure it out or find anything online. If you do
$array1[0]=@array2
it seems to just expand array 2 and store them into 1, not quite what i'm looking for. Is there any way maybe to create the variable names on the fly? ie do something like array$j[0]=data[i]? I'm sure there is some easy solution to this (perl seems to be full of easy (but hard to find) solutions).
Thanks,
Dr. Jones
$array1[0]=@array2
it seems to just expand array 2 and store them into 1, not quite what i'm looking for. Is there any way maybe to create the variable names on the fly? ie do something like array$j[0]=data[i]? I'm sure there is some easy solution to this (perl seems to be full of easy (but hard to find) solutions).
Thanks,
Dr. Jones