<?xml version="1.0" encoding="windows-1252"?>
<node id="19654" title="RE: RE: My views on pseudohashes" created="2000-06-23 20:03:13" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="11052">
Zoogie</author>
<data>
<field name="doctext">
I had no clue what a pseudohash was... until I started searching for "pseudo-hash" instead of "pseudohash".  Apparently, you can use an array as a hash.  Here's a a snippet from [perlref] on the subject:&lt;p&gt;

&lt;blockquote&gt;
Beginning with release 5.005 of Perl you can use an array reference in some contexts that would normally require a hash reference. This allows you to access array elements using symbolic names, as if they were fields in a structure.&lt;p&gt;

For this to work, the array must contain extra information. The first element of the array has to be a hash reference that maps field names to array indices. Here is an example: 

&lt;code&gt;
   $struct = [{foo =&gt; 1, bar =&gt; 2}, "FOO", "BAR"];


   $struct-&gt;{foo};  # same as $struct-&gt;[1], i.e. "FOO"
   $struct-&gt;{bar};  # same as $struct-&gt;[2], i.e. "BAR"

   keys %$struct;   # will return ("foo", "bar") in some order
   values %$struct; # will return ("FOO", "BAR") in same some order

   while (my($k,$v) = each %$struct) {
       print "$k =&gt; $v\n";
   }
&lt;/code&gt;
&lt;/blockquote&gt;

&lt;p&gt;- Zoogie</field>
<field name="root_node">
19636</field>
<field name="parent_node">
19642</field>
</data>
</node>
