i think this will work, but don't complain if it doesn't 'cos im tired. ok?
#!/usr/bin/perl
$count = 0;
while (FILE)
{
if (m/california/)
{
$count++;
}
}
print california: $count\n;
On Tue, Sep 17, 2002 at 08:42:57 -0700,
nope that only counts 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: [EMAIL PROTECTED]
Subject: Re: Counting
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: [EMAIL PROTECTED]
Subject: Re: Counting the same word
i
Are you only looking for 'california' (case-sensitive?) ?
if so:
open (FILE,C:\\proj\\order\.txt) or die cannot open file: $!;
%seen = ();
while (FILE) {
$count += s/california//g; ## substitute returns number of subs
(m// doesn't)
}
print california: $count\n;
-Original
It depends on what you mean by word I would assume you could do something
like
%seen = ();
while( FILE ) {
$seen{lc $_}++ for( split /\s+/ );
}
- Original Message -
From: ANIDIL RAJENDRAN [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 17, 2002 11:42 AM
Subject: