print "\n\nThe Hash Table\n\n"; foreach $thread (keys %threads) { print "$thread: @{$threads{$thread}}\n"; } #this prints out lines like: #keyA: 2 6 8 #keyB: 3 5 10 14 18 #etc. # Convert hash table into arrays for Threads, with common index $tnum $tnum=0; foreach $thread (keys %threads) { $tsub[$tnum] = $thread; $tlist[$tnum] = $threads{$thread}; #store the array reference. $tsize[$tnum] = @{ $tlist[$tnum] }; $tnum++; } print "\n\nThe Thread Arrays\n\n"; for ($i=0;$i<$tnum ;$i++) { print "\n$tsub[$i], size=$tsize[$i], @{$tlist[$i]"; }