Solved

Find words in $something.

Posted on 2002-05-13
3
182 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Six Sigma Control Plans

728 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