in reply to generating hash from array

This should work for you .. You were on the right track, but looks like you wanted a hash of arrays intead of a hash of a hash which is what your code was doing.
use strict; use warnings; my %h = (); while(<DATA>){ chomp; my ($comp,$cmd,$test) = split /-/, $_; push @{$h{$comp}->{$cmd}}, $test; } use Data::Dumper; print Dumper \%h; __DATA__ comp1-cmd1-test1 comp1-cmd1-test2 comp1-cmd2-test1 comp2-cmd1-test1 comp2-cmd1-test2 comp3-cmd1-test1