Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/URL-encoding/Perl/url-encoding-1.pl
Normal file
8
Task/URL-encoding/Perl/url-encoding-1.pl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
sub urlencode {
|
||||
my $s = shift;
|
||||
$s =~ s/([^-A-Za-z0-9_.!~*'() ])/sprintf("%%%02X", ord($1))/eg;
|
||||
$s =~ tr/ /+/;
|
||||
return $s;
|
||||
}
|
||||
|
||||
print urlencode('http://foo bar/')."\n";
|
||||
4
Task/URL-encoding/Perl/url-encoding-2.pl
Normal file
4
Task/URL-encoding/Perl/url-encoding-2.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use URI::Escape;
|
||||
|
||||
my $s = 'http://foo/bar/';
|
||||
print uri_escape($s);
|
||||
6
Task/URL-encoding/Perl/url-encoding-3.pl
Normal file
6
Task/URL-encoding/Perl/url-encoding-3.pl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
use 5.10.0;
|
||||
use CGI;
|
||||
|
||||
my $s = 'http://foo/bar/';
|
||||
say $s = CGI::escape($s);
|
||||
say $s = CGI::unescape($s);
|
||||
Loading…
Add table
Add a link
Reference in a new issue