aboutsummaryrefslogtreecommitdiff
path: root/challenge-021/dave-cross/perl5/ch-2.pl
blob: e0bd00d094ac9323ed7d9402e11da984cf3762e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl

use strict;
use warnings;
use feature 'say';

use URI;

if (!@ARGV) {
  @ARGV = <DATA>;
  chomp(@ARGV);
}

for (@ARGV) {
  say URI->new($_)->canonical;
}

__DATA__
HTTP://www.Example.com/
http://www.example.com/a%c2%b1b
http://www.example.com/%7Eusername/
http://www.example.com:80/bar.html