Keeping track of all the prices in an economy all the time is essential for more reasons than can be set out here, but it's difficult and complicated.
Number crunchers select a basket of goods and services that is as representative as possible of how the average person spends money.
Statisticians travel to retail outlets, restaurant, pubs and other commercial premises with clipboards and, month after month, track how prices for the same things change. If prices increase, we have inflation.
But it's not as simple as that sounds. Over time consumers change their preferences. They stop buying some things and buy more of others. This makes a representative basket of goods a moving target. To mitigate this, statisticians tracking inflation revise lists, and the weighting assigned to each item, using surveys of what consumers are buying now.
More complexity is added by technology. Take mobile phones: the sharpest smartphone is a markedly different animal to the brick-like phone of 20 years ago. Apart from appearance, it offers a range of online services and apps light years beyond the simple call and text functions of yore.
And therein lies one of the difficulties in measuring inflation. Track the price of a phone for long enough and you'll end up comparing apples and oranges.