1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# Solutions by Asbigail
## [Valid Phone Number Formats](https://perlweeklychallenge.org/blog/perl-weekly-challenge-110/#TASK1)
> You are given a text file.
>
> Write a script to display all valid phone numbers in the given text file.
### Acceptable Phone Number Formats
~~~~
+nn nnnnnnnnnn
(nn) nnnnnnnnnn
nnnn nnnnnnnnnn
~~~~
### Input File
~~~~
0044 1148820341
+44 1148820341
44-11-4882-0341
(44) 1148820341
00 1148820341
~~~~
### Output
~~~~
0044 1148820341
+44 1148820341
(44) 1148820341
~~~~
### Notes
The examples show we should not take the specification as a specification;
just a rough guideline. According to the specification,
" +44 1148820341" fails the criteria not once, but twice: it contains
a leading space (not allowed in the specification), and it has only a
single space between the '+44' part and the rest, where the specification
requires two.
We therefore conclude the examples just contain random spaces, and we
can completly ignore any white space in the input.
### Solutions
* [AWK](awk/ch-1.awk)
* [Bash](bash/ch-1.sh)
* [C](c/ch-1.c)
* [Lua](lua/ch-1.lua)
* [Node.js](node/ch-1.js)
* [Perl](perl/ch-1.pl)
* [Python](python/ch-1.py)
* [Ruby](ruby/ch-1.rb)
### Blog
[Perl Weekly Challenge 110: Valid Phone Numbers](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-110-1.html)
## [Transpose File](https://perlweeklychallenge.org/blog/perl-weekly-challenge-110/#TASK2)
> You are given a text file.
>
> Write a script to transpose the contents of the given file.
### Input File
~~~~
name,age,sex
Mohammad,45,m
Joe,20,m
Julie,35,f
Cristina,10,f
~~~~
### Output
~~~~
name,Mohammad,Joe,Julie,Cristina
age,45,20,35,10
sex,m,m,f,f
~~~~
### Solutions
* [AWK](awk/ch-2.awk)
* [Bash](bash/ch-2.sh)
* [C](c/ch-2.c)
* [Lua](lua/ch-2.lua)
* [Node.js](node/ch-2.js)
* [Perl](perl/ch-2.pl)
* [Python](python/ch-2.py)
* [Ruby](ruby/ch-2.rb)
### Blog
[Perl Weekly Challenge 110: Transpose File](https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-110-2.html)
|