my $i; my $j; while <$input>{ $j = (/^[A-Z]) ? 0 : $j+1; $AA[$i++][$j] = $_; }