in reply to Creating file at run time
You can't, in general, do what you want with open() so use sysopen().
You want to create the file if it doesn't exist but you don't want to truncate the file if it exists. You can do this with open() if you use a mode of "+>>" which has the (perhaps) unfortunate side effect of also opening the file in append mode so that any write to the file will get put after the last byte of the file, no matter where the current file position is when you do the write.
To get "create but don't truncate and don't append" behavior, you have to use:
which is unfortunate but matches the limitations of C's fopen(). - tye (but my friends call me "Tye")use Fcntl qw( O_RDWR O_CREAT ); sysopen( FILE, "$Inputfile.out", O_RDWR|O_CREAT, 0777 ) or die "$!";
|
|---|