in reply to Re: File protection in a called script
in thread File protection in a called script

"My bad" sums it up nicely, I didn't write specifically what was going wrong.

In the subscript - it doesn't appear to write to the file. I've set a variable to trap the returned value of the Open statement, and it opens the file allright! But when I've tried to read lines out of that file (@lines = <FILE>, or while <FILE> print $_), nothing prints. Nothing is written. It's a mystery to me.

I also tried at this same point in the script to simply copy the file to another, using system(`cp file1 file2`) as well as regular backticks. In both cases, the created file is size 0! But as I said above, all these tricks I've tried in a standalone script, which runs fine. Bizarre!

Replies are listed 'Best First'.
Re: Re: Re: File protection in a called script
by iburrell (Chaplain) on Nov 15, 2002 at 17:23 UTC
    What does the file contain after the script is finished running? What happens when you run the script from the command-line passing the same arguments? Also, you might want to check the return values of the print and close calls. Those can sometimes fail (although usually not for files) especially if the disk is full.