Re: Counting the same word

2002-09-17 Thread Tanton Gibbs
It depends on what you mean by word I would assume you could do something like %seen = (); while( ) { $seen{lc $_}++ for( split /\s+/ ); } - Original Message - From: "ANIDIL RAJENDRAN" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 17, 2002 11:42 AM Subject: Count

RE: Counting the same word

2002-09-17 Thread Nikola Janceski
Are you only looking for 'california' (case-sensitive?) ? if so: open (FILE,"C:\\proj\\order\.txt") or die "cannot open file: $!"; %seen = (); while () { $count += s/california//g; ## substitute returns number of subs (m// doesn't) } print "california: $count\n"; > -Original Messa

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