in reply to Read fortran list output
at the top of a Perl script. Then you would've seen that you have problems in your use of $j. (It appears to be defined solely in the scope of your initial if, and not defined in the else.)use strict; use warnings;
Other Monks have addressed a better way to solve your problem, but in the case of this specific program, you'd want to say my $j; before the while, and remove the my from the if.
Your code would then look like
ormy $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] = $_; }
|
|---|