sorry, i meant this:

#!/usr/bin/perl

$count = 0;
while (<FILE>)
        {
        if (m/california/g)
                {
                $count++;
                }
        }
print "california: $count\n";


On Tue, Sep 17, 2002 at 12:08:03 -0400, Nikola Janceski wrote:
> 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 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 (<FILE>)
> >     {
> >     if (m/california/)
> >             {
> >             $count++;
> >             }
> >     }
> > print "california: $count\n";
> > 
> > 
> 
> ----------------------------------------------------------------------------
> --------------------
> The views and opinions expressed in this email message are the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.

-- 
Mat Harris                      OpenGPG Public Key ID: CC14DD34
[EMAIL PROTECTED]        matthewh.genestate.com  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to