diff options
| author | sangeet <sangeet.kar@gmail.com> | 2020-06-02 06:42:10 +0000 |
|---|---|---|
| committer | sangeet <sangeet.kar@gmail.com> | 2020-06-02 06:42:10 +0000 |
| commit | 35c76b94e7c2e784a2b94a01e07d79bb8c603978 (patch) | |
| tree | 3c9aa306921b14e54b4210f6888989dfa34f677c | |
| parent | 5637637926532ea61bf497548eeb79dbd07b4974 (diff) | |
| download | perlweeklychallenge-club-35c76b94e7c2e784a2b94a01e07d79bb8c603978.tar.gz perlweeklychallenge-club-35c76b94e7c2e784a2b94a01e07d79bb8c603978.tar.bz2 perlweeklychallenge-club-35c76b94e7c2e784a2b94a01e07d79bb8c603978.zip | |
Ch-1 & Ch-2 raku
| -rwxr-xr-x[-rw-r--r--] | challenge-063/sangeet-kar/raku/ch-1.raku | 8 | ||||
| -rwxr-xr-x[-rw-r--r--] | challenge-063/sangeet-kar/raku/ch-2.raku | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/challenge-063/sangeet-kar/raku/ch-1.raku b/challenge-063/sangeet-kar/raku/ch-1.raku index 92a2788af2..be05c203ff 100644..100755 --- a/challenge-063/sangeet-kar/raku/ch-1.raku +++ b/challenge-063/sangeet-kar/raku/ch-1.raku @@ -1,11 +1,13 @@ +#!/usr/bin/env raku + use Test; sub last_word ($string, $regex) { - $string.words.reverse.first: /$regex/; + $string.words.reverse.first($regex); } is last_word(' hello world', rx/<[ea]>l/), 'hello'; is last_word("Don't match too much, Chet!", rx:i/ch.t/), 'Chet!'; -is last_word("spaces in regexp won't match", rx:s/"in re"/), Nil; -is last_word( join(' ', 1..1e6), rx/^^(3.*?) ** 3/), '399933'; +is last_word("spaces in regexp won't match", rx:s/in re/), Nil; +is last_word( join(' ', 1..1e6), rx/^(3.*?) ** 3/), '399933'; done-testing; diff --git a/challenge-063/sangeet-kar/raku/ch-2.raku b/challenge-063/sangeet-kar/raku/ch-2.raku index f042d46ccf..b6b7eb3f6c 100644..100755 --- a/challenge-063/sangeet-kar/raku/ch-2.raku +++ b/challenge-063/sangeet-kar/raku/ch-2.raku @@ -1,3 +1,5 @@ +#!/usr/bin/env raku + sub MAIN (Str $input) { my $tmp = $input; for 1 ... ∞ { |
