"identify the mistake in my code"

There are a multitude. For a start there are a bunch of variables that seem to be global to the code you give, which is (kinda) OK, but including something to show that those variables are supposed to be global to the outer for loop would be smart ($workbook1, $worksheet, @cellA, ...).

Some variables are clearly not declared correctly ($cellA, $row, ...). $r isn't declared and it's scope isn't obvious.

Your indentation is all over the place. You need to turn most of your if statements inside out:

for my $col ($col_min = 0) { if ($appssheet eq $appsshhetname) { my $cell = $worksheet1->get_cell($row, 0); ... } }

should be:

for my $col ($col_min = 0) { next if $appssheet ne $appsshhetname; my $cell = $worksheet1->get_cell($row, 0); ... }

Because of all the above issues (except maybe the if statements stuff) it isn't possible to check the logic of your code with any certainty. Perhaps you need to turn on strictures and tighten up the scope of your variables as a first step?

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

In reply to Re: Unable to compare 2 arrays from 2 separate columns of separate sheets. by GrandFather
in thread Unable to compare 2 arrays from 2 separate columns of separate sheets. by chandantul

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.