in reply to CGI and Traceroute

Instead of using s/// to filter out the characters you don't want, use it to only allow the characters you do want.

How about something like: $value =~ m/([-.0-9a-zA-Z]+)/; $value = $1; That would only allow dashes, dots, and alphanumerics, which IIRC are all you are allowed to use in a fully-qualified domain name.