You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
271 B
Perl

#!/usr/local/bin/perl
$total = 0;
while ($line = <STDIN>) {
$line =~ s/^[\t ]*//;
$line =~ s/[\t ]*\n$//;
next if ($line eq "");
@words = split(/[\t ]+/, $line);
$total += @words;
}
print ("The total number of words is $total\n");