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