As I'm a bit puzzled your (larger) intent -- ie: why you would want to use a script for a job so easily done with ls text2.txt or dir text2.txt -- I'll guess you may wish to know the contents of the element rather than just a filename.

If that's the case, here's a tiny, incremental step, building on the above, to print the full content of the element (annonymous array) containing test2.txt:

print "Found \$SearchStr in \@cdata:  @{$GrepResult}\n";

If, instead, you wish to store the information for further processing, you can substitute an appropriate construct to hold @{$GrepResult}.

PS: your reference to "the way I am referencing @Config" is the kind of typo that can create confusion or lead to a sequence of off-track replies. Yes, I've inferred (correctly, one hopes) that you meant @cdata but sometimes typos or cut'n'paste errors can confound your hope of help. The preview button is best used both to the check formatting... and to proofread.

...of course, as anyone who's noted the number of "Update" notes in my posts will recognize, this is advice I need to practice more effectively, myself. :-)

Update :-( and I still missed a typo I've now had to correct. ....aaargh!


In reply to Re: find a string in an array of arrays by ww
in thread find a string in an array of arrays by jgatrell42

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.