Also, using split does more work than you need. Try replacing
I personally believe that people indeed tend to overuse split too much. But at the same time IIRC the latter is optimized if an explicit LIMIT parameter and maybe (I only have a vague memory of this, and I admit I may just have "invented" it...) even simply if a specific number of items are assigned, i.e.:
my ($searchfield) = split /'/, $line;
Update: as far as the last point is concerned, I definitely stand corrected, as per ikegami's remark, which I thoroughly trust.
But at this point one should certainly do a benchmark to be sure, and I don't have the slightest intention of doing so, especially given that the question asked by the OP has bigger issues to the point of not really being understandable at all, as far as I'm concerned...