foreach $line (@list_of_files){ if ($line =~ /^\Q$find_file\E\s/){ print ($line); } }