in reply to Printing th entire line with a keyword

It's not really time consuming, but the way you wrote it is memory consuming since it slurps the whole file in the beginning. (And the memory consumption may make it slow if the file is very large.) We can do better by reading one line at a time:

use strict; my $find = "word or string to find"; my $file; open $file, "<", "searchfile.txt"; print "Lined that matched $find\n"; while (<$file>) { if ($_ =~ /\Q$find\E/) { print "$_\n"; } }

Note that I converted your open() syntax to the three-argument form, moved to non-bareword filehandles, and used escapes in the regexp. These are better programming practices.

If you still want it faster, I don't think there's a better way than just using grep(1).