for my $p (qw(field1 field2)) { local $_ = $cgi->param($p); s/\*//g; # or tr/*//d; $cgi->param($p, $_); # set it back }