Gavilan

CSIS054: Perl Programming

Questions for week 6

 

QUESTION ANSWER
(highlight to read)
What happens if I open a file for "writing" if that file already exists? Existing file is destroyed.
What could I do instead? Append. Or choose a new name.
What are the arguments to the open function? A filehandle, and the filename.
What can I do with a filehandle? Read or write it. Close it.
How do I modify the filename if I want to write to the file? ">file"
How do I modify the filename if I want to append to it? ">>file"
What happens if the script crashes while a file is open for writing? It's probably ruined/corrupted.
What if that isn't acceptable? Make a backup before doing a risky operation.
What else can go wrong when opening a file? Disk full. Permissions problems. Network error. Network lag. Murphy's law. etc...
Why can't I open & read a MS-Word formatted (.doc) file from perl? It's not plain-text. Search CPAN for a module.
   

 

 

 



Address of this page is http://hhh.gavilan.edu/phowell/csis054/06questions.html
Please contact Peter Howell at phowell@gavilan.edu for questions or comments.
Last updated January 16, 2010.