Here's the data that I should have added earlier...
Also, the goal is to print the matching 7 digit line. If I found 7770005 I would get the full line from fileB.
(And I change the grep line to a push)
push(@grepnames,grep/$testit/,@fileb);

fileA:
7770005
7770012

fileB:
7770001 ABA BANKING JOURNAL.RECORD # = b12822826. OK
7770002 THE ABNF JOURNAL.RECORD # = b13671558. ok
7770003 ACADEMIC EXCHANGE QUARTERLY : AEQ.RECORD # = b14618114. ok
7770004 THE ACADEMY OF MANAGEMENT REVIEW.RECORD # = b12691070. ok
7770005 THE ACCOUNTING REVIEW.RECORD # = b13123269. ok
7770006 "ACCOUNTING, ORGANIZATIONS AND SOCIETY.RECORD " # = b15123236. ok
7770007 "ACTA CRYSTALLOGRAPHICA. SECTION A: CRYSTAL PHYSICS, DIFFRACTION,
7770008 ADAPTED PHYSICAL ACTIVITY QUARTERLY : APAQ.RECORD # = b13274272. ok
7770009 ADMINISTRATION IN SOCIAL WORK.RECORD # = b12754225. ok
7770010 ADMINISTRATIVE SCIENCE QUARTERLY.RECORD # = b13123415.
7770011 ADOLESCENCE.RECORD # = b13171288. ok
7770012 ADVANCES IN NURSING SCIENCE.RECORD # = b12795896. ok

In reply to Re^2: using grep to search an array by alicatserver
in thread using grep to search an array by alicatserver

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.