in reply to chomp problem

The problem is that symbols.txt is in DOS format (CR-LF). Run:
d2u symbols.txt
and then your code will work. One alternative is to replace chomp with:
s/\r+\n//;
and then your code will work with both DOS and Unix formatted text files.

Remember: There's always one more bug.