miwafu/bin/count-leading-syllables
2014-12-05 09:05:27 -06:00

37 lines
637 B
Perl
Executable file

#!/usr/bin/perl
#
# Setup
#
# Directives
use strict;
use warnings;
# Modules
use File::Basename;
#
# Figure out the directory
#
my $script_directory = dirname($0);
my $root_directory = dirname($script_directory);
my $dict_directory = "$root_directory/dictionary";
#
# Go through the syllable files and build up the counts.
#
foreach my $syllable (glob("$dict_directory/*"))
{
# Ignore non-directories.
next unless $syllable;
# Figure out the counts for this directory.
my @count = glob("$dict_directory/$syllable/*.markdown");
my $count = scalar(@count);
# Write it out.
printf "%3d %s\n", $count, basename($syllable);
}