in reply to comparing two arrays and displaying scalar matches

Thanks for that...however my @array contains records like:
@array = ("TEST SUCCEEDED OK | 11", "TEST FAILED ABORT | 24", "WORDONE", "SCENARIO 2");
So lets say @pattern = ("TEST", "SCENARIO");
I will need the final output to say:
TEST SUCCEEDED OK | 11
SCENARIO 2
Any ideas?
Thanks!
  • Comment on Re: comparing two arrays and displaying scalar matches

Replies are listed 'Best First'.
Re^2: comparing two arrays and displaying scalar matches
by kennethk (Abbot) on Nov 30, 2010 at 16:37 UTC
Re^2: comparing two arrays and displaying scalar matches
by CountZero (Bishop) on Dec 01, 2010 at 07:14 UTC
    TEST FAILED ABORT | 24 also contains the pattern TEST.

    Why shouldn't TEST FAILED ABORT | 24 be in the output as well?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James