in reply to dividing a hash by sets of $num
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, ass +uming 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: dividing a hash by sets of $num
by Anonymous Monk on Mar 14, 2004 at 15:24 UTC | |
by BUU (Prior) on Mar 14, 2004 at 20:59 UTC |