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?


In reply to Multiarray does not read correct value from a table by korak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.