in reply to To Pattern Match or not to Pattern Match

In your else block, you need to add 'last;' to exit the inner loop and go to the next element in the outer loop.
else { print "Name does not exist\n"; last; }
That should prevent that line from printing 10 times.