I don't totally understand it, but I was impressed by Ward Cunningham's use of awk to calculate who owes who after a vacation, http://c2.com/doc/expense/
The author explains the idea: “ The program keeps a running sum that it clears when it sees a blank line (NF==0). Other calculations are performed in place. The first occurrence of a variable name defines it as that sum. Subsequent occurrences become the stored value.”
The regexp that defines what the variable name is is simply: /^[A-Z]+[A-Z0-9]*$/ and numbers to sum and variables are always only the first word in the line.