I'd rather write to a temporary file and rename it at the end
Good thing I wrote a module for that ;-)
use warnings; use strict; use File::Replace 'replace2'; my ($infh,$outfh) = replace2(__FILE__); while (<$infh>) { last if /^__DATA__$/; print $outfh $_; } print $outfh "__DATA__\n"; print $outfh "New stuff! ".gmtime." UTC\n"; close $infh; close $outfh;
In reply to Re^3: Is it possible to modify __DATA__ via the DATA file handle or otherwise?
by haukex
in thread Is it possible to modify __DATA__ via the DATA file handle or otherwise?
by YenForYang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |