you can use XML::LibXML module for this work
In reply to Re^2: Non- greedy regex question by yuvanbala in thread Non- greedy regex question by vit