use URI::Escape qw(uri_escape); # Takes a list of strings, returns them escaped for use in URLs. In scalar # context will only escape the first. sub safe_uri_escape { wantarray ? map {uri_escape($_, "\\W")} @_ : uri_escape(shift, "\\W"); }