aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-04-26 08:13:16 -0400
committerchirvasitua <stuart-little@users.noreply.github.com>2021-04-26 08:13:16 -0400
commit31824ec64fb24a3eb34102980338256d0e152e3f (patch)
treec28f38a2b7fd9d1436d0d956c034b6ffb57470a3
parent1ff197d81f941c3dd35d77bec8a0326807e8d2b1 (diff)
downloadperlweeklychallenge-club-31824ec64fb24a3eb34102980338256d0e152e3f.tar.gz
perlweeklychallenge-club-31824ec64fb24a3eb34102980338256d0e152e3f.tar.bz2
perlweeklychallenge-club-31824ec64fb24a3eb34102980338256d0e152e3f.zip
1st commit on 110_raku
-rwxr-xr-xchallenge-110/stuart-little/raku/ch-1.p620
-rwxr-xr-xchallenge-110/stuart-little/raku/ch-2.p617
2 files changed, 37 insertions, 0 deletions
diff --git a/challenge-110/stuart-little/raku/ch-1.p6 b/challenge-110/stuart-little/raku/ch-1.p6
new file mode 100755
index 0000000000..18ba73dc48
--- /dev/null
+++ b/challenge-110/stuart-little/raku/ch-1.p6
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run <script> <path-to-file or nothing>
+# defaults to text at the bottom if no file is entered
+
+sub getNrs($data) {
+ $data ~~ m:g/([\+\d ** 2|\(\d ** 2\)|\d ** 4]\s+ \d ** 10)/;
+ return $/.map(*.Str);
+}
+
+my $data = (@*ARGS.elems) ?? (@*ARGS[0].IO.slurp) !! ($=finish);
+for (getNrs($data)) {.say};
+
+=finish
+0044 1148820341
+ +44 1148820341
+ 44-11-4882-0341
+(44) 1148820341
+ 00 1148820341
diff --git a/challenge-110/stuart-little/raku/ch-2.p6 b/challenge-110/stuart-little/raku/ch-2.p6
new file mode 100755
index 0000000000..daef3c8a1d
--- /dev/null
+++ b/challenge-110/stuart-little/raku/ch-2.p6
@@ -0,0 +1,17 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run <script> <path-to-file or nothing>
+# defaults to text at the bottom if no file is entered
+
+my @lines = (@*ARGS.elems) ?? (@*ARGS[0].IO.lines) !! ($=finish.lines);
+
+my @transpLines = (zip @lines.map(*.split(/\,\s*/))).map(*.join(','));
+for (@transpLines) {.say};
+
+=finish
+name,age,sex
+Mohammad,45,m
+Joe,20,m
+Julie,35,f
+Cristina,10,f