This wouldn't work as well because he needs to find the words in his string, and use the numbers to replace them. That is, the index should be the data from the input file, which is words, not numbers. Using the numbers as the index would force him to search the entire list for each word which needs to be replaced (although it would save him one array compared with his current two array approach). Using the words themselves as hash keys allows him to do a simple lookup.