Example XML: value #### #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $DATA; my @keys=qq(one two three);# Data we captured from parsing above XML my $newhash=&pfm(@keys,'value');# Make a new hash? $DATA={%$DATA,%$newhash};# Slap it back into the main data hash, repeat as necessary? sub pfm{ } print Dumper $hash; $hash = { 'one' => { 'two' => { 'three' => 'value' } } };