develooper Front page | perl.beginners | Postings from January 2002

RE: File::Find and Platform Capability

Thread Previous | Thread Next
Sean O'Leary
January 30, 2002 12:49
RE: File::Find and Platform Capability
Message ID:
At 03:15 PM 1/30/2002, you wrote:

Always check the return value of system calls to make sure they have 
succeeded.  I think your output file isn't getting opened.

>open(OUT, ">docs.out");

should be something like,

open OUT, "> docs.out" or die "Can't open output file: $!\n";

This way, if the OUT handle can't be opened, your program will die, and 
you'll get a message telling you something like:

Can't open output file: Permission denied


Can't open output file: Disk is full

With the original code, if the file handle doesn't get opened, Perl will go 
right ahead and keep sending output there, which, in this case, is the bit 
bucket.  The script ran successfully on my Win2k SP2 system.



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About