in reply to generating hash from array
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
|
|---|