Hi Monks, I have a very weird problem. Basically, I am trying to update a "cell" in an array of array. e.g. @unique_manufacturer_model->[$i][12]++ Somehow, the exact row/column of another cell (in another array) is also being updated with the same value. I've tried changing the name of the array but does'nt work. The routine printing out the result is confirmed working fine. I just ca'nt understand why updating this array will affect another array of a different name. As you can see below, I do'nt know how the result 5,36,1 can appear in the other array. Here's the code snippets:
for my $i (0 .. $#unique_manufacturer_model) { for my $j (0 .. $#unique_terminal_id) { if ( (@unique_manufacturer_model->[$i][9] eq @unique_terminal_ +id->[$j][9]) and (@unique_manufacturer_model->[$i][10] eq @unique_ter +minal_id->[$j][10]) ) { if (@unique_manufacturer_model->[$i][12] eq "") { @unique_manufacturer_model->[$i][12] = 1; } else { @unique_manufacturer_model->[$i][12]++; } } } } &checkpoint(9,10,12,@unique_manufacturer_model); &checkpoint(10,11,12,@unique_manufacturer_model_version); And here's the output: [root@localhost cron]# perl probe_cron.pl 1) Nokia | N77 | 5 2) Nokia | Nokia N96 | 36 3) | | 1 1) N77 | [V 3.0747.2.0.3|22-11-2007|RM-194] | 5 2) Nokia N96 | [10.045|31-07-08|RM-247|(C) Nokia N96] | 36 3) Nokia N96 | [v 0.0804.X.0.032|06-02-08|RM-247|(C) Nokia N96] | 4) | [] | 1 5) N77 | [V 3.0827.22.0.1-RD|04-07-2008|RM-194] |

In reply to Updating 1 array affects the other array by iphony

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.