Re: Counting the same word

2002-09-17 Thread Tanton Gibbs
2002 11:42 AM Subject: Counting the same word Hi, I want to count the number of times a particular word occured in a file. Though the following script is working, is it possible to shorten it? -- open (FILE,"C:\\proj\\order\.txt") or die "cannot open file: $!"; %see

RE: Counting the same word

2002-09-17 Thread Nikola Janceski
california: $count\n"; > -Original Message- > From: ANIDIL RAJENDRAN [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 17, 2002 11:43 AM > To: [EMAIL PROTECTED] > Subject: Counting the same word > > > Hi, > I want to count the number of times a partic

Re: Counting the same word

2002-09-17 Thread Mat Harris
unts the word once per line.. > if the word was in the line twice it would only count it once. > > > -Original Message- > > From: Mat Harris [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, September 17, 2002 12:06 PM > > To: ANIDIL RAJENDRAN > > Cc: [EM

RE: Counting the same word

2002-09-17 Thread Nikola Janceski
] > Subject: Re: Counting the same word > > > i think this will work, but don't complain if it doesn't 'cos > im tired. ok? > > #!/usr/bin/perl > > $count = 0; > while () > { > if (m/california/) > { >

Re: Counting the same word

2002-09-17 Thread Mat Harris
i think this will work, but don't complain if it doesn't 'cos im tired. ok? #!/usr/bin/perl $count = 0; while () { if (m/california/) { $count++; } } print "california: $count\n"; On Tue, Sep 17, 2002 at 08:42:57 -0700, AN

Counting the same word

2002-09-17 Thread ANIDIL RAJENDRAN
Hi, I want to count the number of times a particular word occured in a file. Though the following script is working, is it possible to shorten it? -- open (FILE,"C:\\proj\\order\.txt") or die "cannot open file: $!"; %seen = (); while () { while ( /(\w['\w-]*)/g) { $seen{lc $1}++; } }