diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-04-26 17:08:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-26 17:08:20 +0100 |
| commit | f28c7552a8cf83175f8da6a5badd4ae153af6a08 (patch) | |
| tree | 979d5ffd6eac3de8e8575292895496c789404fbc | |
| parent | 11af07e28eacf5bfec1ee542c1dbd7b8d1e71291 (diff) | |
| parent | 31824ec64fb24a3eb34102980338256d0e152e3f (diff) | |
| download | perlweeklychallenge-club-f28c7552a8cf83175f8da6a5badd4ae153af6a08.tar.gz perlweeklychallenge-club-f28c7552a8cf83175f8da6a5badd4ae153af6a08.tar.bz2 perlweeklychallenge-club-f28c7552a8cf83175f8da6a5badd4ae153af6a08.zip | |
Merge pull request #3963 from stuart-little/stuart-little_110_raku
1st commit on 110_raku
| -rwxr-xr-x | challenge-110/stuart-little/raku/ch-1.p6 | 20 | ||||
| -rwxr-xr-x | challenge-110/stuart-little/raku/ch-2.p6 | 17 |
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 |
