aboutsummaryrefslogtreecommitdiff
path: root/challenge-020
diff options
context:
space:
mode:
authorJoelle Maslak <jmaslak@antelope.net>2019-08-11 11:26:17 -0600
committerJoelle Maslak <jmaslak@antelope.net>2019-08-11 11:26:17 -0600
commit90af571ca44eb943d834269d7fdec16d4c5fac3c (patch)
tree63ac32f884a4298b36142bf0e7e036bb82ef3dec /challenge-020
parenta502f7b3d4ec12bf59139b3d8082bcc20ce03ce9 (diff)
downloadperlweeklychallenge-club-90af571ca44eb943d834269d7fdec16d4c5fac3c.tar.gz
perlweeklychallenge-club-90af571ca44eb943d834269d7fdec16d4c5fac3c.tar.bz2
perlweeklychallenge-club-90af571ca44eb943d834269d7fdec16d4c5fac3c.zip
Solutions in P6 and P5 for 20.1
Diffstat (limited to 'challenge-020')
-rwxr-xr-xchallenge-020/joelle-maslak/perl5/ch-1.pl12
-rwxr-xr-xchallenge-020/joelle-maslak/perl6/ch-1.p69
2 files changed, 21 insertions, 0 deletions
diff --git a/challenge-020/joelle-maslak/perl5/ch-1.pl b/challenge-020/joelle-maslak/perl5/ch-1.pl
new file mode 100755
index 0000000000..a4a972a84f
--- /dev/null
+++ b/challenge-020/joelle-maslak/perl5/ch-1.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use v5.22;
+
+die "Must provide character string" if scalar(@ARGV) != 1;
+
+my (@parts) = grep { state $i=1; $i++ % 2 } $ARGV[0] =~ /((.)\2*)/gms;
+say join("\n", @parts);
+
diff --git a/challenge-020/joelle-maslak/perl6/ch-1.p6 b/challenge-020/joelle-maslak/perl6/ch-1.p6
new file mode 100755
index 0000000000..11f5ee8dab
--- /dev/null
+++ b/challenge-020/joelle-maslak/perl6/ch-1.p6
@@ -0,0 +1,9 @@
+#!/usr/bin/env perl6
+use v6;
+
+sub MAIN(Str:D $input) {
+ my @matches = $input.comb( / (.) $0* / );
+ say @matches.join("\n");
+}
+
+