Thank you for your reply. I am still very much a beginner at Perl and so unfortunately I am not clear on the approach you are suggesting. To give you an idea of where I am at skill-wise, I am still attempting to apply
BrowserUK's suggested heuristic from above.
I would certainly appreciate any pointers to help me understand your suggestion though.