I had written a code that was working fine until today. Part of the code finds elements in one array that are not present in another array. I have two arrays
1. @sorted_original_cellnames 2. @sorted_top_cellnames
To find the elements that are not found in the first array I wrote
@test1{@sorted_original_cellnames} = undef; @not_found_in_original = grep{!exists $test1{$_}}@sorted_top +_cellnames;
Similarly for the second array I wrote
@test2{@sorted_top_cellnames} = undef; @not_found_in_topcell = grep{!exists $test2{$_}}@sorted_orig +inal_cellnames;
This code was working fine as long as we had the same number of elements in both the arrays. Today I have a new situation -> I have 71 items in the first array and only 66 items in the second. The code is not working properly. It generates  @not_found_in_originalarray with 5 elements of nothing and the @not_found_in_topcell with 5 elements that are missing. Also the code gives following errors
Use of uninitialized value in exists at checkmodlist.pl line 355. Use of uninitialized value in hash slice at checkmodlist.pl line 358.
I tried rewriting the code with foreach, still I get the same problem, any idea to correct this. Thanks in adavance for all who helps me. Augustine

In reply to Extracting elements in one array but not in another by august3

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.