diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-04-21 17:24:29 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-04-21 17:24:29 +0100 |
| commit | 2de6d60a1f0060b522ea4994b7018d7423cdd72a (patch) | |
| tree | ef66e308f47a012c022b053fc71e6b238b788731 | |
| parent | ee04a2badc792f0da4f3d816cc01ad793cd60e62 (diff) | |
| download | perlweeklychallenge-club-2de6d60a1f0060b522ea4994b7018d7423cdd72a.tar.gz perlweeklychallenge-club-2de6d60a1f0060b522ea4994b7018d7423cdd72a.tar.bz2 perlweeklychallenge-club-2de6d60a1f0060b522ea4994b7018d7423cdd72a.zip | |
- Updated solutions by Yary H.
| -rwxr-xr-x | challenge-004/yary-h/perl5/ch-2.pl | 6 | ||||
| -rwxr-xr-x | challenge-004/yary-h/perl6/ch-2.p6 | 2 | ||||
| -rwxr-xr-x | challenge-004/yary-h/perl6/ch-2a.p6 | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/challenge-004/yary-h/perl5/ch-2.pl b/challenge-004/yary-h/perl5/ch-2.pl index 3f8885f218..a40c3f93ae 100755 --- a/challenge-004/yary-h/perl5/ch-2.pl +++ b/challenge-004/yary-h/perl5/ch-2.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -n -# run as "wordy.pl words.txt" +# run as "ch-2.pl words.txt" use strict; use warnings; @@ -11,6 +11,6 @@ state $letters = [split '', 'nnaaabpepl']; # letter bag, in any order chomp; my $orig = $_; for my $letter (@$letters) { - next unless s/$letter//; - say $orig unless $_; + next unless s/$letter//i; + say $orig unless $_; } diff --git a/challenge-004/yary-h/perl6/ch-2.p6 b/challenge-004/yary-h/perl6/ch-2.p6 index 7b34e15fca..9561d43c97 100755 --- a/challenge-004/yary-h/perl6/ch-2.p6 +++ b/challenge-004/yary-h/perl6/ch-2.p6 @@ -7,7 +7,7 @@ my %letters = bag <n n a a a b p e p l>; WORD: for $*ARGFILES.words -> $word { my %counter = %letters; - next WORD unless %counter{$_}-- for $word.comb; + next WORD unless %counter{$_}-- for $word.fc.comb; say $word; } diff --git a/challenge-004/yary-h/perl6/ch-2a.p6 b/challenge-004/yary-h/perl6/ch-2a.p6 index 2e3b74f541..f910878a72 100755 --- a/challenge-004/yary-h/perl6/ch-2a.p6 +++ b/challenge-004/yary-h/perl6/ch-2a.p6 @@ -5,7 +5,7 @@ my %letters = bag <n n a a a b p e p l>; my %counter = %letters; -goto NextWord unless %counter{$_}-- for .comb; +goto NextWord unless %counter{$_}-- for .fc.comb; .say; NextWord: |
