miwafu/bin/count-leading-syllables

38 lines
637 B
Text
Raw Normal View History

#!/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);
}