<?xml version="1.0" encoding="windows-1252"?>
<node id="929316" title="Re: reading flat file" created="2011-10-03 08:35:08" updated="2011-10-03 08:35:08">
<type id="11">
note</type>
<author id="645661">
tospo</author>
<data>
<field name="doctext">
Welcome to Perl!&lt;br/&gt;
This is easily achievd in Perl and the script to do this won't be very long but there are a few things you need to learn. These are:
&lt;ul&gt;
&lt;li&gt;open a file and read line by line (a solution was shown already in a previous reply)&lt;/li&gt;
&lt;li&gt;use regular expressions to get the named fields (tag/value pairs) out of the line of text. You could also use "split" to first split on spaces to get a list of tag/value pairs and then split on the "=" for each one to get the tag and the value.
&lt;li&gt;read the data into a hash - find out what hashes are and how to populate them and read from them.&lt;/li&gt;
&lt;/ul&gt;
Have a go at a short script. Doesn't matter if it doesn't work at first. Post it here if it doesn't work and you will receive more help. Good luck!</field>
<field name="root_node">
929209</field>
<field name="parent_node">
929209</field>
</data>
</node>
