My guess is that line 52 corresponds to
foreach my $m(0..$#row1)
If not, you should indicate since you haven't given us 52 lines of code. In the above, $#row1 is the last index of @row1, which you don't define. Since you want the last index of the array referenced by $row1, you mean
foreach my $m(0..$#$row1)
Note the extra sigil (and see perlref and/or perlreftut). A less error prone way of writing that block assuming you don't need the index would be using a foreach loop on the array itself:
foreach my $record (@$row1)
{
$data_file.= $record->{'ROW_DATA'} . "\n";
}
Update: You are also accessing the array reference improperly in the line
$data_file.= "$row1[$m]{'ROW_DATA'}\n";
which should be
$data_file.= "$row1->[$m]{'ROW_DATA'}\n";
since you need to dereference that reference to access its contents. You should probably (re)read perlreftut to gain insight into how references work in Perl.
|