# A MR job uses counters to count the number of articles according to their # first letter (ignoring the case and possible diacritics). # rm -rf step-4-out-sol; perl step-4-solution.pl /home/straka/wiki/cs-text-medium/ step-4-out-sol package My::Mapper; use Moose; with 'Hadoop::Mapper'; sub map { my ($self, $key, $value, $context) = @_; $key =~ s/^\s+//; $key = uc substr($key, 0, 1); $context->counter("Articles", $key, 1); } package main; use Hadoop::Runner; my $runner = Hadoop::Runner->new( mapper => My::Mapper->new(), input_format => 'KeyValueTextInputFormat'); $runner->run();