Solved

help with concordance

Posted on 2001-06-13
11
274 Views
Last Modified: 2010-03-05
can someone please give me the source code to the exercise in this tutorial

http://www.cs.unm.edu/~bwylie/perl/split.html#exercise

im stuck
0
Comment
Question by:Kitty__Kong
[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
11 Comments
 
LVL 8

Accepted Solution

by:
shlomoy earned 100 total points
ID: 6189509
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6189533

open(IN,"<$filename") or die "Can't open $filename for reading: $!\n";
my $text = join '',<IN>;
close(IN) or die "Can't close $filename after reading: $!\n";
 my @results = ($text=~m/((?:\S+[ \t]+){1,5}$findme[ \t]+(?:\S+[ \t]+){1,5})/gs);    
map {print "===>$_\n";} @results;


0
 
LVL 1

Author Comment

by:Kitty__Kong
ID: 6189637
nothing is getting printed with that code
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:shlomoy
ID: 6189741
did you define $filename?
did you define $findme?
0
 
LVL 1

Author Comment

by:Kitty__Kong
ID: 6189821
yes this is what i used

$filename = "electricity.txt";
$findme = "the";
open(IN,"<$filename") or die "Can't open $filename for reading: $!\n";
my $text = join '',<IN>;
close(IN) or die "Can't close $filename after reading: $!\n";
my @results = ($text=~m/((?:\S+[ \t]+){1,5}$findme[ \t]+(?:\S+[ \t]+){1,5})/gs);    
map {print "===>$_\n";} @results;
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6191116
and you didn't see anything?!
0
 
LVL 1

Author Comment

by:Kitty__Kong
ID: 6192189
nothing prints
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6192225
then I guess there's nothing with "the".
Perhaps there is "THE" or "The"... but not "the".

If you want case insensitivity add 'i' to the m//;

this way:
m/((?:\S+[ \t]+){1,5}$findme[ \t]+(?:\S+[ \t]+){1,5})/gsi
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6967713
All,

This question seems to be abandoned. As part of the ongoing cleanup effort, I will leave a note in
the Community Support topic area which will recommend to the Moderators that they close this question.

My recommendation will be to award the points to shlomoy

PLEASE DO NOT AWARD THE POINTS TO ME.

Experts ===>: please leave your thoughts here. <====

maneshr
(NOT a moderator at EE)
0
 
LVL 1

Author Comment

by:Kitty__Kong
ID: 6972790
well i still havent gotten the answer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6984655
Per recommendation, force-accepted by Netminder, CS Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

630 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