Re: Word Count Question.

2006-04-13 Thread Dr.Ruud
Joshua Colson schreef: > $wc{$1}++ while m/\b(\w+)\b/g; Alternative, ignoring case: $wc{lc $1}++ while m/(\w+)/g; -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Word Count Question.

2006-04-13 Thread Dr.Ruud
"Mr. Shawn H. Corey" schreef: > my $count = () = $lineFromFile =~ m/\b\w+\b/; The "/g" modfier is missing. Do you have a special reason to use \b next to \w? I think it will work equally well without the \b-s. The \w is "digits plus letters plus underscore", which in ASCII is limited to [0-9A-Z

Re: Word Count Question.

2006-04-13 Thread Joshua Colson
On Thu, 2006-04-13 at 15:05 +0100, Max von Seibold wrote: > I'm trying to write a small word counting script - I'm certain there are > zillions out there but it seemed a good learning exercise... > > Bascially I read in each line from my text file which I want to count > with a basic while loop

Re: Word Count Question.

2006-04-13 Thread Dr.Ruud
Max von Seibold schreef: > However this only tells me if there are individual words in each line. > Is there some way I can count there occurrences? See `perldoc count` #!/usr/bin/perl use strict; use warnings; while () { print; print scalar( () = /\w+/g ), "\n"; } __DATA__ Abc, def ghi! J

Re: Word Count Question.

2006-04-13 Thread Mr. Shawn H. Corey
On Thu, 2006-13-04 at 15:05 +0100, Max von Seibold wrote: > I'm trying to write a small word counting script - I'm certain there are > zillions out there but it seemed a good learning exercise... > > Bascially I read in each line from my text file which I want to count > with a basic while loop

Word Count Question.

2006-04-13 Thread Max von Seibold
I'm trying to write a small word counting script - I'm certain there are zillions out there but it seemed a good learning exercise... Bascially I read in each line from my text file which I want to count with a basic while loop and file handle. The problem is on the count. I know I could spli