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.

13 lines
339 B
Perl

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