CSCI 4230
 Internet Application Development
Fall 2001
 Homework #2

Due Date: September 17, 2001 (Monday)

(1)    Consider the following dictionary file: words.txt, which contains one word per line.  Write a Perl program h2q1.pl (program names  should be followed strictly) to read a list of characters and print out all words contain all input characters in exactly the same format as below.  (50%)

For input:

>h1q2.pl a b c d e f

The output should exactly be:

There are 3 words containing all supplied characters:
1: barefaced
2: boldface
3: feedback

For input:

>h1q2.pl a e i o u c d

the output should exactly be:

There are 8 words containing all supplied characters:
1: coeducation
2: colatitude
3: denunciation
4: diatomaceous
5: documentation
6: mendacious
7: quasiperiodic
8: unidirectional

For input:

>h1q2.pl a x b y c z

the output should be:

There are no words containing all supplied characters.

For input:

>h1q2.pl a b c de

the output should be:

Arguments must be single characters.

For input:

>h1q2.pl

the output should exactly be:

usage: h1q2.pl ch1 ch2 ...

Test cases:

(1)    a b c d e f
(2)    a e i o u c d
(3)    x y z w
(4)    a b c de
(5)    [no command line argument]
(6)    d c b a

(2)    Write a simple Perl program, h2q2.pl, to take an URL as the only command line argument and print out the word counts of the body of the URL.  A word is defined as a sequence of lower case or upper case alphabets delimited by non-alphabets.  For example, if the program is called like: (50%)

h2q2.pl http://dcm.uhcl.edu/yue/courses/csci4230/Fall2001/h1.html

the output should exactly be:

Word counts for the url: http://dcm.uhcl.edu/yue/courses/csci4230/Fall2001/h1.html

a => 8.
account => 1.
accounted => 1.
actually => 1.
added => 1.
after => 1.
alink => 1.
and => 3.
application => 1.
as => 1.
at => 2.
author => 1.
b => 7.
be => 3.
been => 1.
bgcolor => 1.
body => 2.
br => 3.
bun => 1.
c => 1.
center => 2.
charset => 1.
cl => 1.
color => 4.
content => 4.
course => 1.
csci => 2.
date => 2.
dcm => 1.
develop => 1.
development => 1.
doctype => 1.
dtd => 1.
due => 2.
edu => 1.
ee => 1.
en => 2.
equiv => 1.
every => 1.
fall => 2.
ff => 1.
ffffcc => 1.
following => 1.
font => 16.
for => 2.
free => 2.
from => 1.
future => 1.
generator => 1.
geocities => 2.
has => 1.
head => 2.
home => 3.
homework => 6.
hosting => 2.
html => 5.
http => 1.
i => 2.
in => 3.
include => 2.
internet => 1.
iso => 1.
isp => 1.
it => 1.
job => 1.
kwok => 1.
li => 4.
link => 5.
look => 1.
may => 1.
meta => 3.
minimum => 1.
moved => 1.
mozilla => 1.
name => 2.
nbsp => 10.
netscape => 1.
note => 1.
nt => 1.
of => 2.
one => 1.
open => 1.
or => 1.
other => 1.
p => 4.
page => 4.
personal => 3.
professional => 1.
public => 1.
question => 1.
regular => 1.
resume => 4.
searching => 1.
september => 1.
should => 3.
simple => 1.
size => 4.
solution => 1.
submitted => 1.
text => 2.
the => 4.
this => 2.
title => 2.
to => 7.
transitional => 1.
type => 1.
u => 1.
uh => 1.
ul => 2.
upload => 1.
used => 1.
vlink => 1.
w => 1.
web => 2.
week => 1.
will => 1.
windows => 1.
work => 1.
you => 2.
your => 6.
yue => 1.

Test cases:

(1)    http://dcm.uhcl.edu/yue/courses/csci4230/Fall2001/h1.html
(2)    http://dcm.uhcl.edu/yue/courses/csci4230/Fall2001/h2.html
(3)    http://www.yahoo.com/
(4)    http://www.franklymydear.com/

For both questions, turn in listings of all source code, test runs and a floppy disk containing your programs.