aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-305/japhy/perl/ch-2.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/challenge-305/japhy/perl/ch-2.pl b/challenge-305/japhy/perl/ch-2.pl
new file mode 100644
index 0000000000..d69c645fe9
--- /dev/null
+++ b/challenge-305/japhy/perl/ch-2.pl
@@ -0,0 +1,10 @@
+#!/usr/bin/perl -l
+
+print join ", " => alien(["perl", "python", "raku"], [qw/h l a b y d e f g i r k m n o p q j s t u v w x c z/]);
+print join ", " => alien(["the", "weekly", "challenge"], [qw/c o r l d a b t e f g h i j k m n p q s w u v x y z/]);
+
+sub alien {
+ my $D = join "", @{+pop};
+ my $t = sub { local $_ = shift; eval "y/a-zA-Z/$D$D/"; $_ };
+ return sort { $t->($a) cmp $t->($b) } @{+shift};
+}