&sysread_uint48($RGB, \@rgbz); # Store RGB in uint64, RGBZ array &RADIX_SORT(\@rgbz); # Sort by digits! $std=$rgbz[0]; # Make first uint64 the STanDard $unique=1; # First one is Always Unique! for($ii=1; $ii < $num_pix; $ii++) { next if($rgbz[$ii] == $std); # Same Old value as last time! $unique++; # New value, Increment Unique $std=$rgbz[$ii]; # Make new THIS the STD } printf("%d distinct values\n", $unique);