my $current_page_num = 2; my $num_pages = 6; if ($current_page_num > 1) { ...display link to page $current_page_num-1... } for my $page_num (1 .. $num_pages) { if ($page_num == $current_page_num) { ...display page number... } else { ...display link to page $page_num... } } if ($current_page_num < $num_pages) { ...display link to page $current_page_num+1... } #### <<Prev {page num} {page num} Next>gt; #### Selector.link_prev -> Link to prev page, if any. Selector.link_next -> Link to next page, if any. page_selector_cell -> Loops over all page nums, setting these: Selector.Page.is_current -> True if page_num is current page. Selector.Page.page_num -> Loop variable. Selector.Page.link -> Link to page page_num.