Computing.Net > Forums > Programming > searching a txt file from an array-

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

searching a txt file from an array-

Reply to Message Icon

Original Message
Name: tim burton
Date: January 25, 2005 at 06:37:11 Pacific
Subject: searching a txt file from an array-
OS: winxp
CPU/Ram: p4/64mb
Comment:

hello

ive been stuck with this bit of code, where it must read keywords from an array, and search them from a .txt file.

foreach $kw(@keywords)
{ $numOccur=0;
while(<FILE2>)
{ if (/$kw/)
{ $numOccur=$numOccur+1;
}
}
push @occurence, $numOccur;


CAN U HELP ME OUT PLZ.. IVE HAV HAD SLEEPLESS NIGHTS WITH THIS!!

THANKS

tim burton


Report Offensive Message For Removal


Response Number 1
Name: FishMonger
Date: January 25, 2005 at 08:53:56 Pacific
Reply: (edit)

{ local $/ = '';
$file = <FILE2>;
}

foreach $kw (@keywords) {
$numOccur++ while $file =~ /\b$kw\b/ig;
}
push @occurence, $numOccur;


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software