Created
May 1, 2014 11:22
-
-
Save anonymous/260ffb652a390fa9bb45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6-m | |
# -*-Perl-*- | |
use v6; | |
my @files = <file1.txt file2.txt file3.txt>; | |
my @all_counts = await do for @files -> $filename { | |
start { | |
my %word_counts; | |
for slurp($filename).words { | |
%word_counts{$_}++; | |
} | |
%word_counts; | |
} | |
} | |
# Bring them together into a single result. | |
my %totals; | |
for @all_counts { | |
%totals{.key} += .value; | |
} | |
say %totals.elems; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment