#!/usr/bin/perl
#
# Count the number of lines in the dictionary file
# Jim Mahoney
#
use strict;
use warnings;
my $nlines = 0;
my $dict   = '/usr/share/dict/words';       # fedora core 2; cs.marlboro.edu
open(DICT,$dict) or die "no dict"; 
$nlines++ while <DICT>;                          # see below
print "$nlines words in '$dict'.\n";


#
#   # More verbose version of counting lines.
#   # Note that <DICT> returns '' when there are no lines, which exits the loop.
#   while (my $line = <DICT>){         # As long as I can read in a line,
#     $nlines++;                       # increment the line number count.
#   }
#
