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}}; $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]"; } The printout reveals several errors: The $tsize[$i] field, instead of showing the number of items in the array, gives the first item of the array, and the @tlist[$i]field, instead of printing all the items of the @tlist array, prints only the first. So the output now looks like: #keyA: 2, 2 #keyB: 3, 3 #etc.