Blanco has asked for the wisdom of the Perl Monks concerning the following question:
I've posted before on this subject but have failed to mention a couple of things. I'm trying to open a file that contains the following data:
block 2022, 2002 6, 78 1023, 1232 etc...
The data format can not change. I want to read the data into an array. This is what I have:
open (DAT, "data.dat") || die ("Error: Could not open the selected fil +e..."); @encoded_ECGdata = <DAT>;
This seems to work (I do not have the speech marks around the DAT within the array declaration I have sharp brackets, I just could not remember how to get it to appear within HTML). Is this right?
Next, I want to read the data in the array created from the file into two seperate arrays. All the data on the left-hand side into one array and all the data on the right-hand side into the other. I would like to keep the word 'block' at the same interval within each array but lose the comas. I would also like to manipulate the data later. Lastly how would I go about outputting the data in the two newly created arrays.
This thing has been driving me nuts - I've just started using Perl last week.
Sorry for the repost, guys.
Updated 2002-04-08 by mirod: added proper code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading arrays
by Fletch (Bishop) on Apr 08, 2002 at 19:15 UTC | |
|
Re: Reading arrays
by tadman (Prior) on Apr 08, 2002 at 19:43 UTC | |
|
Re: Reading arrays
by Blanco (Initiate) on Apr 08, 2002 at 19:35 UTC | |
by dragonchild (Archbishop) on Apr 08, 2002 at 19:45 UTC |