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

RE: File::Find and Platform Capability

Thread Previous | Thread Next
From:
Sean O'Leary
Date:
January 30, 2002 12:49
Subject:
RE: File::Find and Platform Capability
Message ID:
5.1.0.14.0.20020130154247.043b5118@pop.erols.com
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

or

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.

Later,

Sean.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About