aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-09-06 16:28:08 +0100
committerGitHub <noreply@github.com>2019-09-06 16:28:08 +0100
commitd044f7660aa48bca637b8201ce472d6bbea308d5 (patch)
tree1961ad16891caa513ca5b85e153690ba08b786d1
parenta07a1f5cb58d3806abd8d86bea8d400f1829c027 (diff)
parent08c4d67d1954256ab0016412862ba60ad741be9b (diff)
downloadperlweeklychallenge-club-d044f7660aa48bca637b8201ce472d6bbea308d5.tar.gz
perlweeklychallenge-club-d044f7660aa48bca637b8201ce472d6bbea308d5.tar.bz2
perlweeklychallenge-club-d044f7660aa48bca637b8201ce472d6bbea308d5.zip
Merge pull request #601 from duanepowell/pwc24.1
Improve word parsing in build() method
-rwxr-xr-x[-rw-r--r--]challenge-024/duane-powell/README0
-rwxr-xr-xchallenge-024/duane-powell/perl5/ch-2.pl2
2 files changed, 2 insertions, 0 deletions
diff --git a/challenge-024/duane-powell/README b/challenge-024/duane-powell/README
index 3445422743..3445422743 100644..100755
--- a/challenge-024/duane-powell/README
+++ b/challenge-024/duane-powell/README
diff --git a/challenge-024/duane-powell/perl5/ch-2.pl b/challenge-024/duane-powell/perl5/ch-2.pl
index 8cb0bdd84d..8371c68aef 100755
--- a/challenge-024/duane-powell/perl5/ch-2.pl
+++ b/challenge-024/duane-powell/perl5/ch-2.pl
@@ -121,6 +121,8 @@ sub build {
# Parse and count words in $f
while (<$FH>) {
+ # substitue all non-alpha-numberic chars with space then split on space
+ $_ =~ s/[^a-zA-Z0-9]/ /g;
foreach (split(/\s+/,$_)) {
$word_count++;
my $w = lc($_);