<?xml version="1.0" encoding="windows-1252"?>
<node id="1018817" title="Re: Printing Last Element of a line using perl memory?" created="2013-02-14 18:54:35" updated="2013-02-14 18:54:35">
<type id="11">
note</type>
<author id="885521">
hippo</author>
<data>
<field name="doctext">
&lt;p&gt;I do not think that regex will work if you have trailling whitespace in your input data (which there appears to be in your example above). To deal with that, try something like&lt;/p&gt;

&lt;code&gt;m/(\w+)\W*$/;&lt;/code&gt;

&lt;p&gt;instead and see how you get on.&lt;/p&gt;</field>
<field name="root_node">
1018813</field>
<field name="parent_node">
1018813</field>
</data>
</node>
