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 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 particular word > occured in a file. Though the following script is working, > is it possible to shorten it? > > ---------------------------------------------------------------------------- -------------------- 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. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]