From 1c687a28d119b667f8e46ff419b8ea09583014d3 Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Mon, 16 Sep 2019 09:51:49 +0100 Subject: Busy then ill last week but here's a start for this week. --- challenge-026/simon-proctor/perl6/ch-1.p6 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 challenge-026/simon-proctor/perl6/ch-1.p6 diff --git a/challenge-026/simon-proctor/perl6/ch-1.p6 b/challenge-026/simon-proctor/perl6/ch-1.p6 new file mode 100644 index 0000000000..a135a5236b --- /dev/null +++ b/challenge-026/simon-proctor/perl6/ch-1.p6 @@ -0,0 +1,17 @@ +#!/usr/bin/env perl6 + +use v6; + +subset SimpleLetters of Str where * ~~ /^ <[ a..z A..Z ]>+ $/; + +#| Document script +multi sub MAIN( Bool :h(:$help) where ?* ) { say $*USAGE } + +#| print the count of letters in "jewels" there appear in "stones" +multi sub MAIN( + SimpleLetters $stones, #= String to find letters in + SimpleLetters $jewels #= String of letters to look for +) { + my $stone-set = $stones.comb.Set; + $jewels.comb.grep( { $_ (elem) $stone-set } ).elems.say; +} -- cgit