aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2019-04-15 23:57:12 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2019-04-15 23:57:12 +0100
commit54e320fd6e41de9ce1ddd9441924ad37eb245206 (patch)
tree81db89c02c2cd4278e1c72feb12922093a55108c
parentb60ea1e4d152a0c948678b504c5796646548ce53 (diff)
downloadperlweeklychallenge-club-54e320fd6e41de9ce1ddd9441924ad37eb245206.tar.gz
perlweeklychallenge-club-54e320fd6e41de9ce1ddd9441924ad37eb245206.tar.bz2
perlweeklychallenge-club-54e320fd6e41de9ce1ddd9441924ad37eb245206.zip
- Added solutions by Matt Latusek.
-rwxr-xr-xchallenge-004/matt-latusek/perl5/ch-1.pl0
-rwxr-xr-xchallenge-004/matt-latusek/perl5/ch-2.pl23
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-004/matt-latusek/perl5/ch-1.pl b/challenge-004/matt-latusek/perl5/ch-1.pl
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/challenge-004/matt-latusek/perl5/ch-1.pl
diff --git a/challenge-004/matt-latusek/perl5/ch-2.pl b/challenge-004/matt-latusek/perl5/ch-2.pl
new file mode 100755
index 0000000000..f41a49f874
--- /dev/null
+++ b/challenge-004/matt-latusek/perl5/ch-2.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+#
+# First command line argument: letters to be used
+# All other: dictionary files
+# Example: ch-2.pl aabcdefz words
+
+use strict;
+use warnings;
+
+my @l = split( '', shift );
+
+while (<>) {
+ my $w = $_;
+ chomp $w;
+ next if length $w > @l;
+ foreach my $l (@l) {
+ next if ( my $p = index $w, $l ) == -1;
+ substr $w, $p, 1, '';
+ next if length $w;
+ print $_;
+ last;
+ }
+}