in reply to Clarification on greediness
You can try out this:
if ($file=~m#(<first>(?:[^<]+|<(?!/?first>))+</first>)(?:[^<]+|<(?!/?f +irst>))+(<content>maps</content>)#i) { print "\n$1 == $2"; } [download]
Gopal.R