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.
#!/usr/bin/perl
+
use CGI qw(:standard);
use strict;
my $num = param('number') || 0;
print header, start_html;
print "Your number is $num.";
print start_form;
print hidden(-name=>'number', -value=>$num + 1,-override=>1);
print submit('Get next number');
print end_form;
print end_html;
-Any sufficiently advanced technology is
indistinguishable from doubletalk.