Help for this page

Select Code to Download


  1. or download this
    use File::Temp qw(tempfile);
    my $file = 'test.txt';
    ...
    close $fh;
    close $tmpfh;
    rename $tmpfile, $file;
    
  2. or download this
    use Fcntl qw(:seek);
    use File::Temp qw(tempfile);
    ...
    print $fh2 $_ while <$tmpfh>;
    close $fh2;
    close $tmpfh;