<?xml version="1.0" encoding="windows-1252"?>
<node id="1007779" title="Re^3: Regular expression assistance" created="2012-12-07 11:26:30" updated="2012-12-07 11:26:30">
<type id="11">
note</type>
<author id="712372">
kennethk</author>
<data>
<field name="doctext">
Okay, much better.  Assuming you want to do this in the midst of a script and not just piping one liners about, I would use more operations rather than be super sparse on characters.  First, since you have a string that is internally-delimited by newlines, you can use &lt;c&gt;.&lt;/c&gt; to match any character that is not a new line.  This means you can actually grab your line using &lt;c&gt;$cdp =~  m/(.*0x01.*)/&lt;/c&gt;, storing the line in &lt;c&gt;$1&lt;/c&gt;.  You could then [doc://split] that on whitespace and grab the 8th field with &lt;c&gt;(split /\s+/, $1)[7]&lt;/c&gt;.  So collecting all your 8th field matches:
&lt;c&gt;my @switch;
while ($cdp =~  m/(.*0x01.*)/g) {
    push @switch, (split /\s+/, $1)[7];
}
&lt;/c&gt;
If this is not your intent and the way forward is unclear, post explicit desired output so the goal is clear.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-712372"&gt;
&lt;hr /&gt;
&lt;p&gt;#11929 First ask yourself `How would I do this without a computer?'  Then have the computer do it the same way.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1007760</field>
<field name="parent_node">
1007767</field>
</data>
</node>
