Quick comment: Make sure the quote types match when opening the file:


open (FILE, ">text.txt");


-----Original Message-----
From: - [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 10:15 PM
To: [EMAIL PROTECTED]
Subject: Re: how to create a file


On Monday 11 June 2001 19:52, bdale16 wrote:
> I want a perl program when executed to send the data to a file such as
> text.txt but i dont need to open the file first. apparently i don't
> understand what the command is to  do this
>
>  If it is  open close or write ?
>  any suggestions on the right command to use and the yntex so i can
> experiment with saving data created in pearl programs to files

You could...

open (FILE, '>text.txt");
Print FILE "Text to put in file.\n";
close(FILE);

BTW, the > is used before the filename to open it for writing.  Anything
already in the file will be lost of you use this.  If you just want to add
to
the file use >> before the filename when opening it.  Also, if you don't use
> or >> the file will be opened for reading only.

Reply via email to