use Time::HiRes; $file = "index.sense"; print STDOUT "Please type the word you are attempting to find and press return:\n"; $word = ; chomp($word); $pattern = "^" . $word . "%[^%]*\$"; $time_s = Time::HiRes::time(); (-e $file) or die "You need to download $file first\n"; $line = `grep $pattern $file`; chomp($line); if($line eq ""){ print STDOUT "Word $word NOT found.\n"; } else{ print STDOUT "Word $word found.\n"; } $time_e = Time::HiRes::time(); print STDOUT "Time taken: " . ($time_e - $time_s) . "s\n";