I'd try something like this:
use strict;
open (INPUT, "myFile.txt") || die "Couldn't open file: $!\n";
my @majorArray;
while (<INPUT>)
{
my @minorArray = split('\|', $_);
push @majorArray, \@minorArray;
}
This will store a reference to each array within one big array, called
@majorArray. You can then access each array like this:
my $arrayRef = $majorArray[0];
foreach my $temp (@{$arrayRef})
{
print $temp,"\n";
}
or you can get at all of the contents of every array like this:
foreach my $item (@majorArray)
{
foreach my $subitem (@{$item})
{
print $subitem,"\n";
}
}
If you're having trouble with references, you might want to try checking out
How do I loop over a reference to an array? or simply look up references in the documentation. Or, even more simply, push the actual array into the larger array to give yourself a two-dimensional array.
Hopefully, this'll help you get going. Good luck!
- Sherlock