Dear monks, I have two arrays that I have to compare. E.g.:
Array1 ATOM 2198 [b]SG CYS L 51[/b] 39.781 -12.827 5.691 1.00 26 +.67 ATOM 2199 N MET L 52 37.845 -15.766 5.722 1.00 33.08 ATOM 2200 CA MET L 52 38.312 -17.144 5.674 1.00 33.08 ATOM 2201 C MET L 52 37.329 -18.022 4.901 1.00 33.08
Array2 ATOM 2212 [b] CB MET L 52[/b] 17.332 94.112 87.029 1.00 0 +.00 ATOM 2213 CG MET L 52 18.017 94.866 88.170 1.00 0.00 ATOM 2214 SD MET L 52 18.711 96.457 87.699 1.00 0.00 ATOM 2215 CE MET L 52 17.198 97.429 87.820 1.00 0.00 ATOM 2216 N ARG L 53 19.331 91.671 87.132 1.00 0.00
I am supposed to remove elements from array2 that are not present in array1. But my problem is I have to judge the differences based only on the bold text above. i.e., the perl program should compare both the arrays and if the bold part is common in both files, then it should be removed from array2. I am not understanding how I can tell perl to look only for the bold text and ignore the remaining text and number. Can anyone help me? Cheers

In reply to Accessing secondary elements in array by chavanak

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.