CSc 231 Perl Assignment 1 | |
CSc 231 Perl Assignments |
25 pts |
My Line |
Due: Jan 31, 2007 |
Write a perl script
which copies the input to the output
adding ->
to the front and <-
to the end
of each line.
It then
reports the number
lines, the length of the longest line, and the total
number of bytes in the original input. For instance,
the input file
Be careful to handle line terminators correctly. The length of a line does not include its terminator, but it contributes to the total size of the file. Also note that the total size figure may differ between Windows and Unix systems, as the children of DOS use two characters to represent the line terminator, while Unix uses one.
Use
chomp
to trim the
terminator from the line when needed.
You might also be interested to know that the builtin function
length
takes the length of a string.