Why do you want to make your code OO? Most programs in the world are
not OO and do just fine. What benefit do you have to keeping information about the sentence in one place?
As for your problem, you want to use overload, specifically stringify (or '""') and cmp. That way, your objects behave as you'd expect them to when you do something if ( $records[10] eq $records[20] ) { print "Sentence is '$records[10]'\n" }
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?