I am reading a series of lines from a file, each of which has a set of strings separated by commas, and storing each of those strings into arrays. So I have an array of arrays. The first string on line 1 would be $WL[1][1], the second string on line 1 would be $WL[1][2]. The first string of line 2 would be $WL[2][1]. Etc.
$teamnum = 0;
while (<>) { # read in output from CnvBRtxt2wiki.pl
push(@WL, [split(/,/,$_)]); # very cool way to create
$teamnum++; # array of arrays
}
$numteams = @WL; # this works, gives me number of arrays in @WL
print "Number of lines = $numteams\n";
print "Number of teams = $teamnum\n";
for ($team=0; $team<$numteams; $team++) {
$lenoflist = $WL[$team]; # this does not work
# this is really frustrating part. HOW DO I GET LENGTH
# of array within array???
print("lenoflist = $lenoflist\n");
for ($i=0; $i<$lenoflist; $i++) {
print("\[$WL[$team][$i]\]");
}
print "\n";
}
$teamnum = 0;
while (<>) { # read in output from CnvBRtxt2wiki.pl
push(@WL, [split(/,/,$_)]); # very cool way to create
$teamnum++; # array of arrays
}
$numteams = @WL; # this works, gives me number of arrays in @WL
print "Number of lines = $numteams\n";
print "Number of teams = $teamnum\n";
for ($team=0; $team<$numteams; $team++) {
$lenoflist = $WL[$team]; # this does not work
# this is really frustrating part. HOW DO I GET LENGTH
# of array within array???
print("lenoflist = $lenoflist\n");
for ($i=0; $i<$lenoflist; $i++) {
print("\[$WL[$team][$i]\]");
}
print "\n";
}