main page next

Dokumenthantering VT98:03

These are the exercises for the first lab session of the course Dokumenthantering VT98. There are 3 exercises this week and 1 of them is obligatory. The obligatory exercises has been marked with a *.

Write a report about the obligatory exercise. The report should contain at least:

The deadline for handing in the report for this week's exercises is Wednesday February 4, 1998.


Exercises Lab 1

Tip: Try out the examples from the lecture notes before you begin with the exercises. You can find the example code in the file /home/staff/web/priv/dh98/perl/01.all in the programming examples directory.

  1. * Finish the Perl program for simulating the UNIX wc program 01.wc. The program only has to be able to process one file and no wc options have to be implemented. Compare the output of your program with the wc output.

  2. Specify four different regular expressions that match lines containing

    You can test your regular expressions with the perl call:

    perl -e 'while (<>) { if (/X/) { printf; } }' < /corpora/Press65/UnixAscii/p65.001

    (the commend should be on a single line) by replacing the X with the regular expression. For this input file the command should produce 183, 495, 211 and 449 lines respectively.

  3. Expand the Perl/Tk script with a button that kills the window when pressed.


References Week 1

http://stp.ling.uu.se/~erikt/dh97/refguide.ps
The Perl Reference Guide by Johan Vromans.

/usr/local/src/Tk-b11.02/Tk/UserGuide.html
A short Perl/Tk user guide with some programming examples.

/usr/local/src/Tk-b11.02/demos/widget
A demo program for Perl/Tk applications with source code.

http://www.activestate.com/
Page from which Perl for Windows can be downloaded.


Last update: February 16, 1998. erikt@stp.ling.uu.se