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

[MacPerl] Creating Files...



Hello:
        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.

-Brian

---------------------------------
Brian R. Barbash
brb125@psu.edu
---------------------------------