Take another look at the sentence:
No punctuation is necessary between pencil and if. That Beverly would poke her with a pencil is one subordinate clause. If Dr. Lemon bothered to glance their way is a second subordinate clause. Subordinate clauses are incomplete thoughts and cannot stand alone as sentences. Generally, when you connect two subordinate clauses together, you need no punctuation.