I forgot to mention that $file is set via a form.  On first run of the
script, it prints a form to the browser asking for a file name, which you
enter, and then it's submited and sent to the script.  The way I understood
it, when open tries to open a file that doesn't exist, it creates it.
Thanks,

Adam

On 12/24/04 12:15 PM, "John Delacour" <[EMAIL PROTECTED]> wrote:

>> Open(GAMELOG, "$file");
>>     @entries = <GAMELOG>;
>> close(GAMELOG);
> 
> You've had your answer. in your script 'Open' means nothing and the
> file won't be created even if you use 'open'.
> 
> 
>        #!/usr/bin/perl
>        chdir "/tmp";
>        $log = "game.log";
>        open LOG, ">$log" or die $!; # --->   >  !
>        print LOG "success !";
>        close LOG;
>        open LOG, $log;
>        for (<LOG>) { print };
> 
> 
> Make it a rule NEVER to open a filehandle without testing.
> 
> JD

Reply via email to