Random Riddle: A Pencil Problem

A man is stuck inside the average classroom with nothing to write with except his pencil. He is not allowed out until he has written his name on his pencil and can still write with it.

How does he do this?
 

Random Riddle: A Pencil Problem