> 
> On Tue, 26 Oct 2004, Dan Fish wrote:
> 
> > system("myscript.pl arg1 arg2 > myfile.txt");
> > 
> > What is the easiest way to prevent "myfile.txt" from being 
> created if 
> > the script dies or produces no output? (It seems the shell 
> will always 
> > create myfile.txt, regardless)
> 
> Would it be enough to just delete the file if it's empty?
> 
>   du myfile.txt | grep '^0' && rm myfile.txt
> 
> That seems easier than any other approach i can think of.
>  

How about something like this, in your perl program:
-z $file && unlink $file;



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.772 / Virus Database: 519 - Release Date: 10/1/2004
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to