Workshop

 <  Day Day Up  >  

Quiz

1:

To print the last modification time of the file foofile , use

  1. print glob("foofile");

  2. print (stat("foofile"))[9];

  3. print scalar localtime (stat("foofile"))[9];

2:

The unlink function returns

  1. The number of files actually deleted

  2. True or false, depending on success

  3. The number of file deletions that were attempted

Answers

A1:

b or c. Choice b prints the time expressed as the number of seconds since 1970 ”not very useful. Choice c prints the time as a nicely formatted string.

A2:

a. However, choice b is also somewhat true. If no files can be deleted, unlink returns 0, which is false.

Activities

  • As a programming exercise only , try to write a program that lists all the files in a directory, in its subdirectories, and so on.

 <  Day Day Up  >  


SAMS Teach Yourself Perl in 24 Hours
Sams Teach Yourself Perl in 24 Hours (3rd Edition)
ISBN: 0672327937
EAN: 2147483647
Year: 2005
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net