I appologize that this is more of a shell question (tcsh) than a perl
question, but I've found that most of the really good perl guru's are fairly
decent shell wizards as well :-)

I have a c-routine that calls a perl script something like this:

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) 

I can think of a couple of ways offhand...

  1. Within the c-routine, check for an empty file after the script is run
and remove if empty.
  2. Handle the output directly from within the perl script with
open/print/close (I.E. avoid redirection)

I was hoping some shell guru out there knows a more generic approach.   

Thanks,
-Dan


---
Dan Fish - [EMAIL PROTECTED] 
"A -good- dive buddy will be there if you run out of air, a -great- one will
be there before you run out!"


-- 
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