Mayhap you should check out the "-override" option? By default, form values are sticky, and you need to set them explicitly how jeffa did above, or by passing them to your method and setting "-override" to a true value.
use CGI qw(:standard);
my $num = param('number') || 0;
print header, start_html;
print "Your number is $num.";
print hidden(-name=>'number', -value=>$num + 1,-override=>1);
print submit('Get next number');
-Any sufficiently advanced technology is
indistinguishable from doubletalk.