Re: File handle FH opened only for output at submit.plx line 53

[email protected] (Sudarsan Raghavan) Wed, 12 Jun 2002 14:48:43 +0530
Newsgroups perl.scripts
Organization HP ISO
Message-ID <[email protected]>
Yasen Petrov wrote:

> Hello scripters,
>
> I made a script (submit.plx), which records the visitor's details into a
> text file and then another script (table.plx) that puts them into a table.
> But I receive the error: File handle FH opened only for output at submit.plx
> line 53. Here's my code:
>
> open TXT, ">>contacts.txt" or die $!;
> print <TXT>, @details;

This should be print TXT @details; #Remove the comma and '<' , '>' around TXT
The statement as you have here is trying to read from the filehandle TXT which has
been opened in append mode, thus the error.

>
> close (TXT) or die $!;
>
> It's exactly like on the manual. Any suggestions?