Oct 27, 2000, 7:07 AM
Post #1 of 2
I have a script that works fine when the data is stored in the same file as the script.
Reading 2-D Array from file handle
The data is a 2-D array.
because the file is quite large, I stored it in a seperate .txt file to read only from the script.
But the script does not 'see' the data as a 2-d array, as it can't access specific elements.
I have scaled it down to show you what I mean:
Here data in ray.txt
Here is the Script that reads from it:
open (FILE,$TMP) | | die "cannot open file for read";
while (<FILE> )
#test if array has been created.
print "@RAY\n"; #prints OK
$num=scalar(@RAY); #returns 5
$row=($RAY->);#does not work
my $var=($RAY->);#does not work
The exact script works OK if the data is in the same file as the script, once the data is read, the script should work as normal??right?