in reply to Hashes with Multiple Keys and Combining Them
There are no "my" are they yours ????# ------------------------------------------------------------ %Struct = (); open (IN, "Abnova_Product_List.txt"); while(<IN>) { chomp($_); ($Key,$Name,$Desc,$OneApp) = split(/\t/,$_); if (! exists $Struct{$Key}) { $refArray = [$Name,$Desc,$OneApp]; $Struct{$Key} = $refArray; } else { $refArray = $Struct{$Key}; push (@$refArray,$OneApp); } } close(IN); open (OUT, ">Abnova_Products.txt"); foreach $Key (keys %Struct) { $refArray = $Struct{$Key}; print OUT "K=$Key\t".join("\t",@$refArray)."\n"; } close (OUT);
|
|---|