Please use <p> and <br> tags to break up your paragraphs and lines better and please use <code> and </clode> tags to make your code easier to read. You will probably find you get more and better answers if you have mercy on us old folks, not to mention the young folks also. Nicely done, thank you!
I suspect you might be doing your get earlier thank you think. Please consider doing a print "\$page = '$page'\n"; right after the my $page = get line. Maybe that will help us see what's happening.