sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
My tests to see what's going on are simple. I print both $test1 and $test2 along with a foreach(@array) for both setsunless ( grep{$test1 eq $_} @accepted1 && grep{$test2 eq $_} @accepted +2) {
And the tests come back positive. Test1 matches perfectly with an item that worked in the first array (this was working properly until I decided to add the 2nd test) and Test2 matches perfectly with an item from it's array too. But something is making it fail.print "you had test1: $test1<br>"; foreach(@test1) { print "$_<br>"; } print "<br>you had test2: $test2<br>"; foreach(@test2) { print "$_<br>"; }
Is this grep doing something I'm not seeing? Only idea I can come up with is it's testing just the first item in both arrays and if they don't match according to what we want, it says it doesn't work instead of going over every array item.
Thanks for your help, wise monks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multiple greps at once-- possible?
by jdporter (Paladin) on Apr 08, 2004 at 15:03 UTC | |
by sulfericacid (Deacon) on Apr 08, 2004 at 15:15 UTC | |
|
Re: multiple greps at once-- possible?
by dragonchild (Archbishop) on Apr 08, 2004 at 15:18 UTC | |
by Abigail-II (Bishop) on Apr 08, 2004 at 16:07 UTC | |
by hardburn (Abbot) on Apr 08, 2004 at 16:06 UTC | |
by mpeppler (Vicar) on Apr 08, 2004 at 16:04 UTC | |
|
Re: multiple greps at once-- possible?
by Roy Johnson (Monsignor) on Apr 08, 2004 at 16:26 UTC | |
by Abigail-II (Bishop) on Apr 08, 2004 at 16:49 UTC | |
by ccn (Vicar) on Apr 08, 2004 at 20:49 UTC | |
by Roy Johnson (Monsignor) on Apr 08, 2004 at 17:39 UTC |