in reply to string initialization error

my $page = ""; $page = $query->param("page");

Don't do that if you want to test $page afterwards. Instead do something like this:

my $page = $query->param ('page') || '';

This way $page will always be defined, even if you don't have a param with the name "page".