diff options
| -rw-r--r-- | challenge-029/ozzy/perl6/ch1.p6 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-029/ozzy/perl6/ch1.p6 b/challenge-029/ozzy/perl6/ch1.p6 new file mode 100644 index 0000000000..a888ab5574 --- /dev/null +++ b/challenge-029/ozzy/perl6/ch1.p6 @@ -0,0 +1,23 @@ +#!/usr/bin/env perl6 + +# wk21ch1 - Write a script to demonstrate brace expansion. + +sub MAIN ( Str $string = 'Perl {Daily,Weekly,Monthly,Yearly} Challenge' ) { + + grammar G { + + token TOP { ( <h> \{ <alt>+ % ',' \} <t> )+ } + token h { <[\w\d\s]>* } + token alt { <[\w\d\s]>+ } + token t { <[\w\d\s]>* } + + } + + my @m = G.parse($string)[0]; + my @r = ""; + + for ^@m.elems -> $i { + @r = (@r X~ @m[$i]<h> X~ @m[$i]<alt> X~ @m[$i]<t>); + } + map { .say }, @r; +}
\ No newline at end of file |
