You probably don't really mean ASCII when you say ASCII, but rather "control characters", or some such.
As for replacing certain characters, or ranges of characters, see tr, or s (update: here are maybe more useful links, as the rather large section "Quote and Quote-like Operators" that the respective entries in perlfunc refer you to, might be somewhat distracting for the uninitiated: tr, s).
For detecting them, maybe something like this (the set [^\x20-\x7e] denotes characters not in the range hex 20-7e (decimal 32-126) ):
my $s = "foo \x03 bar \x05 baz";
printf "detected strange char: 0x%x\n", ord for $s =~ /[^\x20-\x7e]/g
+;
__END__
detected strange char: 0x3
detected strange char: 0x5
|