korak has asked for the wisdom of the Perl Monks concerning the following question:
Multiarray does not read correct value from a table. The problem is the following. I am trying to use the value read from a csv table into a formula to calculate latitude. The problem is that when I f.ex print the multiarray like this: print $multiarray[2][15] it shows the correct value. But if I am using the while function to step i for each line it will only print the value for $multiarray[0][15] even if I have set it up to print like this: $multiarray[i][15]. I have even set up a print to get the value of i like this print $i. And i has the correct number. What can be the problem here?
$multiarray[i][15] =~ s/\,/./g; print "array is $multiarray[2][15] and multiarray +15 is $multiarray[i][15] and then the number i is $i\n"; $latitude = ((($multiarray[i][15]) / 90) * 8388608 +); print "i is $i and latitude $latitude +and latitude $latitude2 and longitude $longitude\n"; $latitude2 = ceil($latitude); print "i is $i and latitude $latitude +and latitude $latitude2 and longitude $longitude\n";
The problem is not that "i" doesnt have the correct value...it does. But multiarray seems to be stuck on the first value read into the variable. I am also exchanging a comma with a dot on the variable to be able to read it and calculate correctly. That seems to be fine too. Any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiarray does not read correct value from a table
by 2teez (Vicar) on Jun 20, 2013 at 07:24 UTC | |
|
Re: Multiarray does not read correct value from a table
by kcott (Archbishop) on Jun 20, 2013 at 07:16 UTC | |
by korak (Initiate) on Jun 20, 2013 at 10:25 UTC | |
|
Re: Multiarray does not read correct value from a table
by hdb (Monsignor) on Jun 20, 2013 at 07:22 UTC | |
|
Re: Multiarray does not read correct value from a table
by AnomalousMonk (Archbishop) on Jun 20, 2013 at 11:51 UTC |