Hash tables, also known as associative arrays, can be hijacked to encode string-based tree structures as explained in the code snippet below. The keys in the genome hash-tree follow the syntax: nodeTYPExx, where TYPE is replaced by an all-capitals string describing the type of the node (see Section 7.2), and xx is a unique identifier (for there may be many nodes of the same type).
$tree{nodeS0} = 'One day in {nodeS1}.'; $tree{nodeS1} = '{nodeS2} {nodeS3}'; $tree{nodeS2} = 'late'; $tree{nodeS3} = 'August'; $string = $tree{nodeS0}; do { print "$string\n" } while ($string =~ s/{(\w+)}/$tree{$1}/); # outputs the following: One day in {nodeS1}. One day in {nodeS2} {nodeS3}. One day in late {nodeS3}. One day in late August.