in reply to How do you write to the middle of a file?

Such is the evil of the standard (read UNIX) file model. One solution is as follows:
$flen = -s $file; # file length in bytes $from = 42; # insertion point open FILE, '+<the/file.ext' or die "Couldn't open file: $!"; read FILE, $buf, ($flen - $from), $from; seek FILE, $from, 0; print FILE 'blahblahblah', $buf;