diff options
| author | Joelle Maslak <jmaslak@antelope.net> | 2019-05-23 21:37:02 -0600 |
|---|---|---|
| committer | Joelle Maslak <jmaslak@antelope.net> | 2019-05-23 21:37:02 -0600 |
| commit | cc0ccdbe4b735451b6309a7510ef460734e24f67 (patch) | |
| tree | f21cbd4e9707706bb2639e47d88c460dc95bedb8 | |
| parent | cb67c028d73600d184c2de4913d15429ac20afac (diff) | |
| download | perlweeklychallenge-club-cc0ccdbe4b735451b6309a7510ef460734e24f67.tar.gz perlweeklychallenge-club-cc0ccdbe4b735451b6309a7510ef460734e24f67.tar.bz2 perlweeklychallenge-club-cc0ccdbe4b735451b6309a7510ef460734e24f67.zip | |
Solution to week 8 challenge 1 in P5 & P6
| -rwxr-xr-x | challenge-009/joelle-maslak/perl5/ch-1.pl | 27 | ||||
| -rwxr-xr-x | challenge-009/joelle-maslak/perl6/ch-1.p6 | 11 |
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]; + |
