diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-09-06 16:28:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-06 16:28:08 +0100 |
| commit | d044f7660aa48bca637b8201ce472d6bbea308d5 (patch) | |
| tree | 1961ad16891caa513ca5b85e153690ba08b786d1 | |
| parent | a07a1f5cb58d3806abd8d86bea8d400f1829c027 (diff) | |
| parent | 08c4d67d1954256ab0016412862ba60ad741be9b (diff) | |
| download | perlweeklychallenge-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/README | 0 | ||||
| -rwxr-xr-x | challenge-024/duane-powell/perl5/ch-2.pl | 2 |
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($_); |
