Change the my $tree='$hash->{'.join('}{',@tree)."}=$value";
line to my $tree='$hash->{'.join('}{',@tree).'}=$value';
or you will be REALLY unhappy the first time you send a string through...
You don't want $value to be interpreted until the
eval.
Update: Nevermind, repeat after me kids, "eval is a
four letter word". =)