Solved

Find words in $something.

Posted on 2002-05-13
3
169 Views
Last Modified: 2010-03-05
Hi.
I'm looking for a way to find the number of occurances of a word in a webpage.
I do something like this:

use LWP::Simple;
$doc = get 'http://www.freebsd.org/'

What I'd like to do now is to find out how many "and" there is in this webpage that I currently have in the $doc variable.
Anyone have a clue on how to to this? I'll figure it out eventually by myself but since there are some smart people here I
thought I'd ask.

wbr

.haeger
0
Comment
Question by:haeger
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
bebonham earned 50 total points
ID: 7006950
%count = map { $_ => $count{$_}++ } split(/\s+/,$doc);  
0
 
LVL 8

Expert Comment

by:bebonham
ID: 7007145
why did you give me a b?

you have already noticed that people give you 'A's for your answers, which are not as good, why should you give me a B, without telling me what is wrong with my answer?
0
 
LVL 1

Author Comment

by:haeger
ID: 7007793
Hi.
Nothing is wrong with your answer. I thought you gave me a good answer and since "B" was "Good" I thought that was appropriate.
The answer I got was short, sweet and to the point but there was nothing extra or special. Had there been a more fine-grained scale 1-10 or 1-5 You would have gotten a higher mark(6-7 or 4 respectivly), but in my opinion there is a difference between "Good" and "Excellent".

I'm not impossible however. Do you still feel that the grade is inappropriate and wrong and there is a way to change it I can do that. I really did appriciate your help.

wbr

.haeger
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question