`grep...` v grep /.../
Posted on 2003-03-08
I have an application that extracts a relatively few lines from a relatively large file. Right now my code reads:
@records=`grep $whatToLookFor theFile`;
I did it this way rather than:
since I was wrried that perl may actually bring in the entire file and then do the grep. Cleraly my method has the disadvantage of using an extra shell invocation. If I replace with the =grep/.../ will perl read the file line by line and do the greap, or will it be as horrible as I was concerned about?