Perl
Overview
Introduction
Why yet
another utility?
Beginning
Perl
Invoking Perl
Documentation on
perl
Perl Scripts
Variables
Input
and output
Files and
redirection
Pipes
The DATA
filehandle
Fields
Control structures
Predefined Perl
Functions
Modules
Regular expressions
Single
character translation
String
editing
Perl and the Kernel
Quality
code
When do I use Perl?
Summary
Exercises
|
Exercises
-
Write a Perl script which takes one argument, assumed to be the
URL of a web site (such as www.any.site.com ), and
displays on standard output the email address of
postmaster at that site
(postmaster@any.site.com ). Ensure your script outputs
suitable error messages if the script is run without exactly one
argument.
-
Write a Perl script to mimic a simple version of
fmt . It should read text on standard input, and write
the words (a word is a string of characters terminated by a space
or the end of a line) one by one to standard output. As many words
as possible, separated by single characters, are to be on each
output line. Each output line has a maximum width of 72
characters.
View solution
-
You are provided with a file of coordinate data generated by a
GPS ('Global Positioning System') device which has logged a
journey. This takes the form of a text file in which each line
consists of two decimal numbers, representing a map coordinate in
kilometres, the first line being the start of the journey and the
last line the end. Write a Perl script, taking one argument which
is a filename, and outputs a message which is the calculated total
length of the journey.
View solution
|