Chapter 1: 3 sentences Chapter 2: 5 sentences Chapter 3: 4 sentences Chapter 4: 6 sentences The chapter with the longest chapter is 4, so we pad all of them to 6 Chapter 1: 01, 02, 03 # 04, 05, 06 are padded real: 01, 02, 03 Chapter 2: 07, 08, 09, 10, 11 # 12 is padded real: 04, 05, 06, 07, 08 Chapter 3: 13, 14, 15, 16 # 17 and 18 are padded real: 09, 10, 11, 12 Chapter 4: 19, 20, 21, 22, 23, 24 # no padding real: 13, 14, 15, 16, 17, 18 Now let's say someone says, what chapter does 15 belong to? ceil(15 / 6) = 3 Now let's say someone wants to know the true ordinal overall value my %pad = (1 => 0, 2 => 3, 3 => 4, 4 => 6); 15 - $pad{ceil(15 / 6)} = 11 Now let's say someone wants to know what is the ordinal value of the sentence within the chapter 15 mod 6 = 3