On Thu, Jun 07, 2001 at 12:39:33PM -0400, Andrew Nelson wrote:
> You can open a file via open() for reading or writing, but not both. Try
>
> open (FILE, $file);
> print FILE;
> close(FILE);
>
> And see if that doesnt help.
>
Not quite true. To read and write, try
open (FILE, "+<$file");
Note that if you do the reverse:
open(FILE, "+>$file");
then you open for read-write, but the file gets clobbered first by the
">" part, so there won't be much there to read.
perldoc -f open, as I'm sure everyone else has already suggested.
If you want to read and then append, I think you would probably have to
read it in, close the filehandle, and then reopen for append. Someone
will correct me if I'm wrong.
cheers
rob c