david2008 has asked for the wisdom of the Perl Monks concerning the following question:
When running the code i get the errormy $fh = FileHandle->new(">>$log_file") || die "could not open $log_fi +le: $!"; truncate $fh,0 || die "could not truncate $log_file: $!"; $fh->close() || die "could not close $log_file: $!";
I tried to find the solution with google.
The only restriction i found is that the file has to be opened in append mode (which is our case)
http://perldoc.perl.org/perlport.html#truncate
What are i am doing wrong?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: problems with truncate function
by johngg (Canon) on Jun 26, 2013 at 09:29 UTC | |
by david2008 (Scribe) on Jun 26, 2013 at 09:35 UTC | |
Re: problems with truncate function (perloperator precedence or ||)
by Anonymous Monk on Jun 26, 2013 at 08:04 UTC | |
by Anonymous Monk on Jun 26, 2013 at 08:09 UTC | |
by david2008 (Scribe) on Jun 26, 2013 at 09:26 UTC | |
by MidLifeXis (Monsignor) on Jun 26, 2013 at 12:17 UTC | |
Re: problems with truncate function
by tobias_hofer (Friar) on Jun 26, 2013 at 07:59 UTC | |
by david2008 (Scribe) on Jun 26, 2013 at 09:18 UTC |