11 lines
271 B
Perl
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");
|