title: How to extract data between a particular tag from a string in Perl?
body: <p>For example, from the following string</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;&lt;root&gt;&lt;point&gt;&lt;message&gt;hello world 1&lt;/message&gt;&lt;/point&gt;&lt;point&gt;&lt;data&gt;&lt;message&gt;hello world 2&lt;/message&gt;&lt;/data&gt;&lt;/point&gt;&lt;/root&gt;
  </code></pre>
  
  <p>if I want to extract <code>message</code>, the result should be</p>
  
  <pre><code>hello world 1
  hello world 2
  </code></pre>
  
  <p>Is there an easy way to do this?</p>
  
  <p>All I can think of is to first find out the position of  and  and then generate substrings in a loop. Is there a better way?</p>