jgatrell42 has asked for the wisdom of the Perl Monks concerning the following question:
I have an array of arrays that looks like the following:
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 @cdata = (["test1.txt", "Subject2", 200], ["test2.txt", "Subject2", 300], ["test3.txt", "Subject1", 600], ["test4.txt", "Subject4", 900], ["test5.txt", "Subject6", 200], );
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 JGatrellmy $SearchStr = "test2.txt"; my $GrepResult = grep(/$SearchStr/,@cdata);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: find a string in an array of arrays
by Jenda (Abbot) on Feb 07, 2008 at 00:28 UTC | |
Re: find a string in an array of arrays
by Tanktalus (Canon) on Feb 06, 2008 at 22:01 UTC | |
by lodin (Hermit) on Feb 06, 2008 at 23:20 UTC | |
by johngg (Canon) on Feb 06, 2008 at 23:02 UTC | |
Re: find a string in an array of arrays
by hipowls (Curate) on Feb 07, 2008 at 00:21 UTC | |
Re: find a string in an array of arrays
by ww (Archbishop) on Feb 07, 2008 at 02:35 UTC |
Back to
Seekers of Perl Wisdom