gautamparimoo has asked for the wisdom of the Perl Monks concerning the following question:
Hi. I want empty the file contents before writing into it again.The following is my code:
open(FILE1 , ">" ,"testing1.txt"); print FILE1 "stat"; #Do the required actions print FILE1 "stat-updated"; close(FILE1);
The output file contents will be:
stat stat-updated
But I want the output file to contain just :stat-updated.How to do it?? Do I need to close the filehandle or call truncate or something else??
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Empty File Contnts before writing
by tobyink (Canon) on Feb 19, 2013 at 07:46 UTC | |
by Athanasius (Archbishop) on Feb 19, 2013 at 08:01 UTC | |
by gautamparimoo (Beadle) on Feb 19, 2013 at 09:47 UTC | |
by johngg (Canon) on Feb 19, 2013 at 10:04 UTC | |
by RichardK (Parson) on Feb 19, 2013 at 11:41 UTC | |
| |
by locked_user sundialsvc4 (Abbot) on Feb 19, 2013 at 13:56 UTC | |
by gautamparimoo (Beadle) on Feb 20, 2013 at 05:43 UTC | |
by johngg (Canon) on Feb 20, 2013 at 23:17 UTC | |
|
Re: Empty File Contents before writing
by Athanasius (Archbishop) on Feb 19, 2013 at 07:44 UTC |