aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Sommrey <28217714+jo-37@users.noreply.github.com>2022-05-24 14:22:25 +0200
committerJörg Sommrey <28217714+jo-37@users.noreply.github.com>2022-05-27 18:01:09 +0200
commit780ce6107eca4fae3e52184a89a39bed8e45f6c0 (patch)
tree9be30937cfbfb89771f66f40624f6c6e296df0fb
parentfcd2d4bdde323600dd7022afb0c5374c3d324795 (diff)
downloadperlweeklychallenge-club-780ce6107eca4fae3e52184a89a39bed8e45f6c0.tar.gz
perlweeklychallenge-club-780ce6107eca4fae3e52184a89a39bed8e45f6c0.tar.bz2
perlweeklychallenge-club-780ce6107eca4fae3e52184a89a39bed8e45f6c0.zip
Solution to task 1
-rwxr-xr-xchallenge-166/jo-37/perl/ch-1.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-166/jo-37/perl/ch-1.pl b/challenge-166/jo-37/perl/ch-1.pl
new file mode 100755
index 0000000000..1453c835a7
--- /dev/null
+++ b/challenge-166/jo-37/perl/ch-1.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use v5.16;
+use warnings;
+
+$ARGV[0] ||= '../../../data/dictionary.txt';
+
+while (<>) {
+ chomp;
+ tr/olist/01157/;
+ next unless /^[0-9a-f]{2,8}$/;
+ # Allow a maximum of two lesser comprehensible letters.
+ # Force global match into list context, then convert to scalar.
+ # See "Goatse" in perlsecret.
+ next if 2 < (() = /[157]/g);
+ say "0x\u$_";
+}