=pod
Leaw, Chern Jian wrote:
to the format listed below when printing it out to the standard output:
abinabdu
adanie2 agibson agoh1 aiabouse
akko alau alee1 alee2 amitb amohdali amshams anmohand
my %count;
while (<DATA>) { for my $word (split) { next unless $word =~ /\w/; $word =~ s/^\W+//; $word =~ s/\W+$//; $count{lc $word}++; } }
for my $word (sort keys %count) { print "$word\n"; }
__END__ abinabdu adanie2 agibson agoh1 aiabouse akko alau alee1 alee2 amitb amohdali amshams anmohand
Or, to use it on a file:
my $file = shift || "no input file given";
open (FHANDLE, "<$file") or die "owie, cannot open $file";
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 "$word\n"; }
__END__
hth; -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>