in reply to Re^6: Error opening file handle within while loop (uninitialized value in array)
in thread Error opening file handle within while loop

What steps have you undertaken to ascertain your assumption?

For example, the following prints the number of elements in the array @columns:

print 0+@columns;

And the following shows you the values of the elements:

use Data::Dumper; print Dumper \@columns;

Personally, I would always look at the line where @columns gets initialized, and also inspect the source data, by printing the line $line1.

Replies are listed 'Best First'.
Re^8: Error opening file handle within while loop (uninitialized value in array)
by rjc33 (Sexton) on Feb 10, 2016 at 13:33 UTC
    Was just checking, seemed to be a problem with splitting by tab (I thought it was a tab delimited file) rather than whitespace, which fixed it and gave the correct number of elements in the array. All working now, apologies for the collection of simple errors, and thanks for everybody's help!