The template processor will just interpret your data correctly and Do The Right Thing to return the correct value to you. In this example each team was a hash, but in a larger system each team might be an object, in which case name , played , etc. No changes would be required to the template as the template processor would realise that it needed to call methods rather than access hash values. A more complex example Stats about the English Football League are usually presented in a slightly more complex format than the one we used above. A full set of stats will show the number of games that a team has won, lost or drawn, the number of goals scored for and against the team and the number of points that the team therefore has.
Teams gain three points for a win and one point for a draw.
When teams have the same number of points they are separated by the goal difference, that is the number of goals the team has scored minus the number of team scored against them. To complicate things even further, the games won, drawn and lost and the goals for and against are often split between home and away games. Let's take such a file, but we'll only look at the top three teams. 2,Arsenal,16,7,1,0,17,4,2,3,3,7,9,11,31 3,Leicester,16,4,3,1,10,8,4,2,2,7,4,5,29 Notice that we've introduced the third parameter to process . If this parameter is a scalar then it is taken as the name of a file to write the output to.