Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sub InFile { local($outfile) = @_; if( -e $outfile) { if( open(SRC_FILE, $outfile)) { open(DEST_FILE, ">TEMPFILE_TOPLOG"); local($date1) = scalar localtime(); print DEST_FILE (@header); print DEST_FILE ("*** Log generated on $date1\n"); $line = <SRC_FILE>; while($line ne "") { print DEST_FILE ($line); $line = <SRC_FILE>; } close(DEST_FILE); close(SRC_FILE); local($filename1) = "TEMPFILE_TOPLOG"; local($newfile) = $outfile; $status = system("mv $filename1 $newfile");# HERE ERROR COMES if ($status != 0) { print "FAILED WHILE MOVING mv $filename1$newfile\n"; return 1; } } else { print "FAILED WHILE OPENING $outfile\n"; return 1; } } return 0; }
20050301 Janitored by Corion: Added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: help related to modifiaction of read only value attempted error
by chromatic (Archbishop) on Mar 01, 2005 at 07:57 UTC | |
|
Re: help related to modifiaction of read only value attempted error
by tphyahoo (Vicar) on Mar 01, 2005 at 09:57 UTC |