aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-05-24 12:07:34 +0100
committerGitHub <noreply@github.com>2019-05-24 12:07:34 +0100
commita795fe80e675428cab5c85d8f51bc08fc522b711 (patch)
treef21cbd4e9707706bb2639e47d88c460dc95bedb8
parentcb67c028d73600d184c2de4913d15429ac20afac (diff)
parentcc0ccdbe4b735451b6309a7510ef460734e24f67 (diff)
downloadperlweeklychallenge-club-a795fe80e675428cab5c85d8f51bc08fc522b711.tar.gz
perlweeklychallenge-club-a795fe80e675428cab5c85d8f51bc08fc522b711.tar.bz2
perlweeklychallenge-club-a795fe80e675428cab5c85d8f51bc08fc522b711.zip
Merge pull request #170 from jmaslak/joelle-9-2-1
Solution to week 9 challenge 1 in P5 & P6
-rwxr-xr-xchallenge-009/joelle-maslak/perl5/ch-1.pl27
-rwxr-xr-xchallenge-009/joelle-maslak/perl6/ch-1.p611
2 files changed, 38 insertions, 0 deletions
diff --git a/challenge-009/joelle-maslak/perl5/ch-1.pl b/challenge-009/joelle-maslak/perl5/ch-1.pl
new file mode 100755
index 0000000000..f91e6c8553
--- /dev/null
+++ b/challenge-009/joelle-maslak/perl5/ch-1.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+use v5.24;
+use strict;
+use warnings;
+
+#
+# Copyright (C) 2019 Joelle Maslak
+# All Rights Reserved - See License
+#
+
+# Turn on method signatures
+use feature 'signatures';
+no warnings 'experimental::signatures';
+
+use List::Util qw(uniqnum);
+
+while (1) {
+ state $num = 99;
+ $num++;
+
+ my $square = $num * $num;
+ next if (join '', sort split '', $square) ne (join '', uniqnum sort split '', $square);
+
+ say $square;
+ exit;
+}
+
diff --git a/challenge-009/joelle-maslak/perl6/ch-1.p6 b/challenge-009/joelle-maslak/perl6/ch-1.p6
new file mode 100755
index 0000000000..0c6aff3fde
--- /dev/null
+++ b/challenge-009/joelle-maslak/perl6/ch-1.p6
@@ -0,0 +1,11 @@
+#!/usr/bin/env perl6
+use v6;
+
+#
+# Copyright © 2019 Joelle Maslak
+# All Rights Reserved - See License
+#
+
+my $seq = (0..∞).map( *² ).grep( { .comb.sort eq .comb.unique.sort } ).grep( *.chars ≥ 5 );
+say $seq[0];
+