in reply to Improving the efficiency of this piece of code

First of all please don't play games with the font. The usual one is fine.

Secondly rather than calling functions using:   &index; it is better to call it with    index(); so you don't accidentally pass in the wrong parameters. (The first form reuses your current parameters.)

Third I would suggest that you have a final case that reports what the parameter was and that it was not understood. This will help debugging when (in my experience not if) things go sour.

Fourth in chatter you got the suggestion to call param('page') once and put that in a variable. That idea is a good one.

Fifth, you are using strict, good, but I think you are using too much from CGI. Try :standard until that runs into problems. (Or using the OO form.)

I could add more, but this is probably more than enough to digest at one go...