I suggest you to use a programmer's editor with colour syntax highlighting. When I loaded your code into my editor, I could see immediately that you did not close the double quote on the
print "$snailmail{$name}; line. Plus a lot of other problems, such as unbalanced brackets, can be spotted at a glance.
If you are working on a Windows platform, you could try the excellent freeware editor
ConTEXT. And if you are working on Unix platform, you could try the nedit or Emacs.