123456
sub url_encode { my $text = shift; $text =~ s/([^a-z0-9_.!~*'( ) -])/sprintf "%%%02X", ord($1)/ei; $text =~ tr/ /+/; return $text;}