<?xml version="1.0" encoding="windows-1252"?>
<node id="762883" title="Re: Non-regex Methods of Extracting the Last Field from a Record" created="2009-05-08 13:12:42" updated="2009-05-08 13:12:42">
<type id="11">
note</type>
<author id="211693">
allolex</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;em&gt;
so I was looking for a simpler, array-manipulation method of extracting the last item from a variable length array.
&lt;/em&gt;&lt;/blockquote&gt;

&lt;p&gt;
This made me think of pop() as yet another approach to getting the right field from the array.
&lt;/p&gt;
&lt;code&gt;
my $rec = 'a b c d e f 96';
my @a   = split /\s+/, $rec;
printf "ads = %s\n", pop @a;
&lt;/code&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-211693"&gt;
&lt;p&gt;
--&lt;br /&gt;
Damon Allen Davison&lt;br /&gt;
&lt;a href="http://www.allolex.net"&gt;http://www.allolex.net&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
762725</field>
<field name="parent_node">
762725</field>
</data>
</node>
