The Tutorials here will tell you everything you need to know about opening a file and reading the words therein. You will probably store them in an array. Here's a trick to detect when two words differ by only single letter:
if (($word1 ^ $word2) =~ tr[\1-\255][] == 1) {
...
}
That works because the ^ operator performs an XOR function. Same letters in $word1 and $word2 become null values, and the tr function returns the count of how many matches it found. I told it to look for non-null values. If the count is 1, that's a word we want to look at.
Update: should have looked at the other replies before I composed this one. Better and more complete answers already provided!
But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)