my @pages=(page1=>page2=>page3=>page4=>); my $i=get_current_page(); my $next_page=$pages[$i+1]; my $prev_page=$page[$i-1];