in reply to DIY Tie

You will have to re-write some of the file as the position of the data will change, so it must be reflected on the disk (unless the changed data is the same length as existing data). To do a partial re-write you can just open a file for reading+writing with something like
open( my $fh => '+<', $your_file ) or die "ack: $!"; ## read up to a point read_stuff() or last while <$fh>; ## remember where you were my $last_pos = tell $fh; my $rest_of_file = do { local $/; <$fh> }; $rest_of_file =~ s<$a_regex>($replace); ## go back to where you were seek $fh => $last_pos, 0; print {$fh} $rest_of_file; close $fh;
While not a marvellous example, it should give you some idea of how to partially edit a file. See. open, tell and seek for more info.
HTH

_________
broquaint