in reply to Stopping system()

Well ... I'm sure there are ways to make your native perl code loop without running out of memory ... but to directly answer your question, look at the man page for grep.

-m NUM, --max-count=NUM Stop reading a file after NUM matching lines. ....
-derby

Replies are listed 'Best First'.
Re^2: Stopping system()
by KurtSchwind (Chaplain) on Oct 30, 2007 at 13:33 UTC
    I was going to mention that. Also you can pipe your results to head.
    grep BLAH INFILE.txt | head -1
    Either way, it'll stop processing as soon as a match has been found. Also awk could be used. It's *nix, so there are lots of ways of doing it. If grep does what he wants, I say use it.
    I used to drive a Heisenbergmobile, but everyone I looked at the speedometer, I got lost.