%hoh = (); foreach my $temp (sort @{$arr1} ) { my ($comp, $cmd, $test) = split(/\-/, $temp); $hoh{$temp} = { comp => $comp, cmd => $cmd, test => $test, }; }