It is not ok to parse HTML/XML with regexes. As @mu mentioned, try using an XML parser - you can achieve what you want with XML::Simple
for example.
Have a look at the tutorial XML for Perl developers, Part 1: XML plus Perl -- simply magic
It is more than you need, but will offer you a good introduction to working with XMLs in Perl