in reply to array matching

C'mon! Firstly, what you posted isn't HTML Code.

But far more significant, you merely assert that you tried to write the Perl to satisfy your spec... but don't show any code to support that claim. And then you start discussing array matching ... but, while we can infer arrays, you haven't shown any.

In short, your post falls short of the mark for lack of precision; the missing demonstration of effort; and the absence of code & associated verbatim errors messages, if any.

So, I'd suggest you take one step back and read On asking for help and How do I post a question effectively? (with special attention to the fact that this is not a factory churning out free code but rather, a venue to share wisdom and help newcomers to master Perl) and the regex section of Tutorials here. You almost certainly also have perldoc perlretut as a resource, right on your own computer. You'll also find that what I think is your question is answered repeatedly, here. Try hunting around the Q&A section (also available from the links just below the Monastery's bannder) and maybe follow up with a Google or Super Search for a triplet of terms like Perl array matching.

Then, come back with a fresh effort and any remaining questions (including the missing material above) and you'll likely get cheerful and expert advice.