use warnings; use strict; use CGI; use Proc::Background; my $args = new CGI; if(!defined $args->param('step')) { print $args->header; blah blah blah print $args->end_html; exit; } if($args->param('step') == 0) { $step = 1; my $proc1 = Proc::Background->new("perl","./myscript.pl","arg1","arg2"); } elsif($args->param('step') > 0) { $step = $args->param('step'); $step ++; } print $args->header(-Refresh=>"5;url=http://localhost/cgi-bin/mycgi.pl?step=$step"); ... print "; print $args->end_html; exit;