in reply to how to dereference for the following hash of hash of arrays

Your hash isn't being built the way you think it is (hint: put a use Data::Dumper at the head of the code and then print Dumper %component_tree to see for yourself). You probably want something like this:

%component_tree = ( component1 => { command1 => "001", command2 => "002", } );
etc. In which case you can get the command id for a command with e.g. $component_tree{component1}->{command1}

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan