#!/usr/local/bin/perl $wordcount = 0; $line = ; while ($line ne "") { chop ($line); @array = split(/ /, $line); $wordcount += @array; $line = ; } print ("Total number of words: $wordcount\n");