use CGI; my $c = CGI->new(); my %hash = qw/data and stuff/; #however you fill the hash #Step 1 my @keys = sort keys %hash; # this should maintain the same order, assuming hash doesn't change #Step 2 my $counter = $c->param('page'); #step 3 my $begin = $counter * $items_per_page; my $end = $begin + $items_per_page; #step 4 print @hash{ @keys[ $begin..$end ] }; #deep voodoo