Solved

Find words in $something.

Posted on 2002-05-13
3
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delete query using perl dbi 3 121
Any syntax error for this clone.plscript 6 148
How to get all the API from website? 11 156
Create an automated page index 9 107
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…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

734 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