sub change_punch_process { my %numbers; foreach (my $par = $q->param ) { $numbers{$1}++ if /^([0-9]+)/; { } # now you can get all your numbers with keys %numbers