Here is the code:
use CGI qw(:standard);
my $num = param('number') || 0;
print header, start_html;
print "Your number is $num.";
print hidden('number', $num + 1);
print submit('Get next number');
The first time this is run, it prints "Your number is 0" and the hidden field is set to 1, as expected. But when I click on the button and it calls count.cgi?number=1, it prints "Your number is 1" but the hidden field is again set to 1! Why isn't it going to 2?