#!/usr/local/bin/perl
#word-count program that handles multiple spaces and tabs between words
$wordcount = 0;
$line = <STDIN>;
chop ($line);
while ($line ne "") {
@words = split(/[\t ]+/, $line);
$wordcount += @words;
$line = <STDIN>;
chop ($line);
}
print ("Total number of words: $wordcount\n");