my $fn= "words.txt";
open ($fn), $file;
if (! -e "$fh") $fh="STDIN";
while (<$fn>){;
my $total_words = @words; #All word count
my %count;
$count{$_}++ for @words; # Here are the counts
my $uniq_words = scalar keys %count; # Number of uniq words
}
# Print sorted by frequency
print "$_\t$count{$_}" for (sort { $count{$b} <=> $count{$a} } keys %count);
close FILE;
exit 0
我收到此错误:
Scalar found where operator expected at wordlist.pl line 8, near ") $fh"
(Missing operator before $fh?)
syntax error at wordlist.pl line 8, near ") $fh"
Execution of wordlist.pl aborted due to compilation errors.
请帮忙