"a new page shuld not be loaded . the new data should come in the same page"
in reply to problem in href and pagination
You could simulate that using frames, possibly.
A lot of your code doesn't make much sense to me. For example;
I don't see that $page has ever been defined. You should use warnings; and use strict;, check your
code using perl -c yourscript.pl, and some of the obvious errors will be revealed to you.
for $i (1 .. $total_pages)
if ($i == $page)...
(Also, if you try to use correct spelling and formatting - like beginning sentences with caps, putting periods or question marks at the ends of sentences, etc, and generally make it look as if you took some care in your posting,
you may get more responses, at least IMHO.)