in reply to Search strings stored in array into files of a directory

and if the string is found i.e matched in a file the it should discontinue its search
You want to say: Possibly you meant "report matches only once per line and string", but this isn't clear. If that's your goal, then you should consider pme's tip, or look at ack which incidentally is written in perl, too.

If it's for the learning experience, it is also a good idea to state your goals as clearly as possible, and then describe the intended course of action in detail. If you did the latter good enough, you can derive a considerable part of your program's structure from that.

  • Comment on Re: Search strings stored in array into files of a directory