You could also try to specify the characters you want, and replace everything else (this makes sure you don't miss any special characters you haven't thought of (yet)).
untested:
$tvid =~ s/[^a-zA-Z0-9_-]/_/g;
Update: Fletchs solution using tr///cs would be more efficient.