Probably the better way to go here (because URLS can have many funky chars) is to find out what they can't have and regex on that instead. I am not very good with regexes but you could try something like
if ($urlcheck =~ m/[^\s]/){
#stuff to do bad url here
}