hOURS wrote:
> Hi all,
Hello,
> I'm trying to make a list of lists. The main list will have 926 sublists.
> Each sublist will have 7 items. I organized the data into a very nice
> text file all formatted the way (I thought?) I needed it to be. The text
> file looks like so:
> a, b, c, d, e, f, g
> h, i, j, k, l, m, n
> o, p, q, r, s, t, u
> v, w, ...
>
> My code to get this into a 2-dimensional list starts by opening the text
> file. Then I have a line
> @RawData = <FILE>;
> At this point I have a 1-dimensional list, 926 items long, where each item
> is a string, (each of those strings being 7 numbers separated by commas).
> I want to convert each of those 926 strings to lists. That way, on this new
> list I can get at individual numbers easily by say,
> @FinishedData[x][y]
my @FinishedData;
while ( <FILE> ) {
chomp;
push @FinishedData, [ split /\s*,\s*/ ];
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>