aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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