in reply to Re^4: thread count
in thread thread count

The keys of the %tids hash are the individual thread ids.
So add the following after building the hash in your loop
$tidc=(keys %tidc); print "Number of unique threads referenced is: $tidc\n";
(keys %tids) is an array of the keys of the hash, assigning an array to a scalar sets it to the number items in the array