I have an array of arrays that looks like the following:
my @cdata = (["test1.txt", "Subject2", 200],
["test2.txt", "Subject2", 300],
["test3.txt", "Subject1", 600],
["test4.txt", "Subject4", 900],
["test5.txt", "Subject6", 200],
);
Now I want to be able to look for the file name. Since the list can get rather long I decided maybe incorrectly to use grep.
my $SearchStr = "test2.txt";
my $GrepResult = grep(/$SearchStr/,@cdata);
Nothing is found. Now if I change the array to a simple array of file names it works great. That lead me to believe that the way I am referencing @Config is incorrect. I have not been able to get this to work.
Thanks
JGatrell
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.