# 
# I banged this out a few minutes after reading this weeks quiz.  :-)
# 
# 
#!/usr/bin/perl -w
use strict;

@ARGV = '/usr/share/dict/words';
my %hash;

while ( <> ) {
    chomp;
    next unless /\A[[:alpha:]]+\z/;
    my $word = lc;
    while ( length $word >= 4 ) {
        my $chunk = substr $word, -4;

        # if there are already two entries in the array
        # then there is no point in adding to the array
        push @{$hash{$chunk}}, $_ if @{$hash{$chunk}} < 3;

        chop $word;
        }
    }

open Q, '>', 'questions' or die $!;
open A, '>', 'answers'   or die $!;

for ( grep @{$hash{$_}} == 1, sort keys %hash ) {
    print Q "$_\n";
    print A "$hash{$_}->[0]\n";
    }

__END__


John
-- 
use Perl;
program
fulfillment
