WC -Sx- Jones wrote:



Grrr, I forgot about MANY files:


my @files = @ARGV ? @ARGV : die "I need at least one filename argument\n\n";


foreach my $filetarget (@files) {
 open (FHANDLE, "<$filetarget") or die "owie, cannot open $filetarget";

my %count;

 while (<FHANDLE>) {
    for my $word (split) {
      next unless $word =~ /\w/;
      $word =~ s/^\W+//;
      $word =~ s/\W+$//;
      $count{lc $word}++;
    }
 }

 for my $word (sort keys %count) {
    print "$filetarget - $word\n";
 }

 close(FHANDLE) or die "ouchies";
}

__END__


Sorry; -Bill- __Sx__________________________________________ http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to