- 论坛徽章:
- 0
|
#!/usr/bin/perl -w
use strict;
while(<>){
foreach(split){
my $total++;
next if/\W/;
my $valid++;
my $count{$_}++;
}
}
print "total things=$total,valid words=$valid\n";
foreach $word(sort keys %count){
print "$word was seen $count{$word} time.\n";
} |
执行的时候报这样的错误:
syntax error at ./danci line 8, near "$count{"
syntax error at ./danci line 8, near "++;"
syntax error at ./danci line 10, near "}"
Execution of ./danci aborted due to compilation errors. |
|