You need to look for open / close. Example:
open(TMP, "> test.file") || die "Can't open test.file: $! \n"; >From there you are printing to it print TMP "Whatever you are wanting to get into the file"; And closing Close(TMP); -----Original Message----- From: ZHAO, BING [mailto:[EMAIL PROTECTED] Sent: Monday, November 07, 2005 2:50 PM To: beginners@perl.org Subject: about creating a file in directory Hi, It seems pretty easy to unlink a file from a directory, but wherever describes unlinking file has no counterpart on create a file. I did perldoc -q file: got what seemed to be what I need, then tested my program, no good: opendir PDB,"SCRATCH" or die "cannot open the SCRATCH dir:$!"; my @GG=grep{!/^./ && !/^../} readdir(PDB); #to store all the file names in the array @GG my $NN=scalar (@GG+1); $filenamie="PDB_$NN.txt"; open LOO,">>SCRATCH/$filenamie" or die "cannot open the SCRATCH/$filenamie:$!"; sysopen(LOO, "SCRATCH/$filenamie", O_WRONLY|O_TRUNC|O_CREAT) || die $!; sysopen(LOO, "SCRATCH/$filenamie", O_WRONLY|O_TRUNC|O_CREAT, 0666) || die $!; select LOO; print "linking was successful!"; This didn't work. What was wrong? thanks a lot. best, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
smime.p7s
Description: S/MIME cryptographic signature