Workshop

Quiz

1:To have data generated by your program display a page at a time, use
  1. perl myprog.pl | more

  2. open(M,"| more") || die; print M"data...data...data....\n";

  3. open(M,">more") || die; print M"data..data...data...\n";

2:Which value of $foo is used in this statement: $r='dir $foo'?
  1. The shell's value for $foo.

  2. Perl's value of $foo is substituted, and then the dir is run.

3:Which of the following tasks changes depending on what system you have?
  1. Finding the amount of free disk space

  2. Getting a directory listing

  3. Deleting a directory

Answers

A1: Either a or b. In the case of a, all output of myprog.pl is fed to more. In the case of b, any data written to the M file descriptor is fed to more for paging.
A2: To protect $foo from Perl's expansion, you ...

Get Sams Teach Yourself Perl in 24 Hours 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.