spanner has asked for the wisdom of the Perl Monks concerning the following question:
This returns (incorrect):$largeArray[0] = "this is a test"; $largeArray[1] = "this is another test"; $largeArray[2] = "that is another test"; $largeArray[3] = "test this is another"; $searchCriteria[0] = "another"; $searchCriteria[1] = "test"; if (@newArray = grep {/@searchCriteria/} @largeArray) { print @newArray; }
which returns (correct):if (@newArray = grep {/another/ and /test/} @largeArray) { print @newArray; }
|
|---|