In cycles material how to get stencil effect similar to blender internal material
With trial and error I got this result, which is what I was looking for. The two images are mixed based on the pupil image's alpha channel, overlaying it onto the eye image. Next the eyes are mixed with the background using the eye texture's alpha channel.