Hi all
I want to parse a text file into an array of array, one line per small array, one letter per element of small array
So if I have a text file containg:
Hello
my
name
is
Jack
The array has to look like this:
@MainArray element 1 ---> elements of small array ---> H, e, l, l, o
@MainArray element 2 ---> elements of small array ---> m, y
@MainArray element 3 ---> elements of small array ---> n, a, m, e
@MainArray element 4 ---> elements of small array ---> i, s
@MainArray element 5 ---> elements of small array ---> J, a, c, k
I have something along these lines, but I don't how to add the part where each new line in the text file is added as a new small array in @MainArray. All this does is add every letter to one large @MainArray
open (A1, "<2 normaal.txt") or die "can't open"; my @MainArray; while (<A1>) { my $in = $_; chomp $in; push (@array1, split(//, $in)); }
Thanks in advance for any help, much appreciated
In reply to Parse txt file into array of array by Dr Manhattan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |