Retaining the value of a variable in Perl

I've a GUI front-end (HTML and JavaScript) a Perl back-end. On clicking a certain button on the home page of the front-end, the Perl back-end receives a specific argument. So this argument leads to change of value of a variable (

$checkInfo

) which is then given back to the GUI. The GUI now pops up a message which displays

$checkInfo

and on closing the pop-up, another page (say page 2) opens. On page 2 is a certain button which emails

$checkInfo

to a certain email address.

The problem I'm facing is that

$checkInfo

is equal to

""

on page 2. On page 1, the back-end returns

$checkInfo = something

to the GUI but that value is lost when I go to page 2. I've tried declaring $value as

state $checkInfo

but that doesn't work either. I use

$checkInfo

only in the

main()

function.

In the code, all you need to know is that

preSubmitCheck::autoSubmitCheck

return the value such that

$checkInfo->{rc} != 0

and in the first iteration

$mode ne 'ticket'

but

$mode eq 'ticket'

in the second iteration. In the second iteration, I need the value of $checkInfo to be the same as the first iteration value.