Harlan Ellison did not like William Shatner counting lines in the script.
Some others making comments on this.
http://filmscoremonthly.com/board/posts.cfm?threadID=64749&forumID=7&archive=0
Shatner toupee
http://shatnerstoupee.blogspot.com/2009/08/more-flying-toupees.html
http://mentalfloss.com/article/19433/3-bald-encounters-set-star-trek#comment-92379
I’ve read Ellison’s account of this in a book about the episode. The same book contains a treatment and one of the versions of Ellison’s screenplay for this episode.