First of all, the hash is ALWAYS retrieved in a specific order, so we don't need to worry about that.
I'm worried about that. Why will it ALWAYS return in the correct order? Is it a special tied hash or something? If not, then the order may as well be random. In fact in perl5.8.1, for security reasons, the order is going to different every time you run the code.
Anyway, one thing that strikes me is that your range is funny. If $page = 2, then $top = 40 and $bottom = 20, which will give you 21 items per page. So I think you want to do
and then, rather than having a special case for $page="" you could write the whole thing asmy $top = ($page * 20) - 1; my $bottom = $top - 19;
my $page = url_param('page'); $page = 1 if $page eq ""; # fixup $page my $top = $page* 20 - 1; my $bottom = $top - 19; for ( grep defined($_), ( reverse keys %upload )[ $bottom .. $top ] ) { do this if url_param exists ... }
That said, I don't think there's anything in the above that would fix the symptoms you've described...
In reply to Re: mathematical equation
by fergal
in thread mathematical equation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |