<?xml version="1.0" encoding="windows-1252"?>
<node id="929214" title="Re: reading flat file" created="2011-10-02 19:45:52" updated="2011-10-02 19:45:52">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
&lt;P&gt;&lt;I&gt;Is there a way to refer these values by name, DOB after i read the record in the PERL program?&lt;/i&gt;
&lt;P&gt;Show your program ([id://174051])
&lt;P&gt;Or see [id://928496|hash_reference from file]
&lt;P&gt;Or see &lt;C&gt;
#!/usr/bin/perl --
use strict;
use warnings;
use Data::Dumper;
print Dumper( kvkv( 'asdf=asdf blah=blah ra=rah' ) );
sub kvkv {
  my %foo;
  while( $_[0]=~ /([^=\s]+)=([^=\s]+)\s*/g ){
    $foo{$1}=$2;
  }
  return \%foo;
}
__END__
$VAR1 = {
          'blah' =&gt; 'blah',
          'ra' =&gt; 'rah',
          'asdf' =&gt; 'asdf'
        };&lt;/c&gt;
</field>
<field name="root_node">
929209</field>
<field name="parent_node">
929209</field>
<field name="reputation">
13</field>
</data>
</node>
