I have the following code: What I am trying to do is look through one text file that has the results of a system-run PS command based off of another text file that keeps track of all commands/programs ever run by PS for some experimentation I am doing for college. In my $search_results variable I am attempting to store the result of that search. I use qx() to start up grep. Instead though of grep returning the instance of the search_result,It's like grep returns the entire contents of the file and I dont know why. I have tested the searches in command line and they come up with results I am looking for, but when I run them in the way I have it in Perl, it returns the entire contents of the original text file that I searched. You guys have any ideas on how I can search a text file in Perl in a straightforward manner in Perl? I have looked into Regular Expressions, but I am not sure how I would approach this yet. Any help would be appreciated. Thanks in advance! P.S. Ignore some of the comments I have in there right now. The comments are actually my goal for what I want a line to do. If you have any ideas let me know as well!