in reply to Optimizing a script

Obviously your problem is not just performance, but the first two lines of your loop could be combined (untested):
my ($file) = /\n.*?"(.*?)".*?\n/ or next;
(If your data allows, remove the final .*?\n)