Exercises

  1. Write a program to check whether two files are equal. Make sure that it works on binary files.

  2. Write a conversion program that converts text files between the various end-of-line style formats. The three formats available are

    • UNIX/Linux— End of line is linefeed (\012).

    • Microsoft Windows— End of line is carriage-return/linefeed (\015\012).

    • Apple— End of line is carriage-return (\015).

  3. Write two programs that communicate to each other through a shared file.

  4. Write a replacement for the command more that pages through text. Include a capability to go back.

  5. Write a program that goes through a log file and checks to see whether any lines match a particular pattern. The program should not exit; rather, it should wait for the file to grow, and ...

Get Perl for C Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.