foreach my $key (keys %input) { $input{$key} =~ tr/*//d; # or whatever makes sense }