Remove the exit statement or you won't even be able to use the module. also, I'd STRONGLY suggest using
strict, lexical variables and pass the values as function arguments instead of relying on vars that are declared (or not) SOMEWHERE else.
then do something like:
use ModuleName;
# ...
pageNumbers($total_pages,$matches,$total_records_page, @and_whatever_o
+ther_variables_you_need);