http://qs321.pair.com?node_id=1233684


in reply to processing file content as string vs array

The performance of regexes can vary depending on the regex itself, there are some cases where excessive backtracking can cause regexes to be quite slow on long inputs. Often adjusting the regex can help, but then it really depends on exactly what the data looks like, which you haven't shown. But if it's possible to read the file into an array and filter that, then it should also be possible to read the file with a while(<>) loop and store only the lines you need, instead of reading the entire file into memory.