So I'm getting input from STDIN like:
1 2 3
4 5 6
7 6 3
4 3 2
2 3 5
2 5 1
Blank lines separate the matrices, so the above input should create two multi-dimensional arrays...I know how to create one (code below), but how do I create multiple ones depending on how many blank lines the user inputs?
I won't know how many arrays the user wants to create so how can I dynamically create arrays depending on the blank lines in the user input?
my @arrayrefs;
while(<>)
{
chomp;
my @data = split(/\s+/,$_);
push @arrayrefs, \@data;
}
for $ref (@arrayrefs){
print "[@$ref] \n";
}