[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Creating Files...



--- Brian R. Barbash wrote:
I'm very new to programming in Mac Perl (or just plain old Perl for
that matter), so please bear with me.  I need to be able to create a file
and place data in it from a variable.  For example:

print ("Enter the filename to save into:\n");
$filename = <STDIN>;
chop ($filename);
die ("Error: cannot open file $filename for writing.") unless open
(Outputfile, ">$filename");
print Outputfile ("$data_to_go_into_file\n");
close (Outputfile);

Since the file does not actually exist yet, the die command is executed.
How do I create the file to write the information into?  Thanks in advance
for any help.
--- end of quoted material ---

the file should be created.  your program works fine for me (in 5.06r1m) (i.e.,
it creates a file).  what name are you entering?  what directory are you in?