There is a Seinfeld episode where George loses his glasses, yet he is able to spot a coin on the floor by squinting. Without knowing the team at Seinfeld made a very elegant scientific experiment comparing lenses to pin holes.
A Lens makes things sharp by focusing rays of light coming from a source so the rays converge on a single sport.
A pinhole, on the other hand, only allows light to enter from a single direction thus not letting it blur.
Both aspects are very clearly explained in this video by MinutePhysics.