in reply to Re: Elegant Way of Inserting Text at the Start of the File
in thread Elegant Way of Inserting Text at the Start of the File
That won't insert. You can't insert into a file. You need to move everything that comes afterwards yourself.
My test (Windows and linux) shows it still appends despite the seek.
>copy con file foo bar ^Z 1 file(s) copied. >perl -le"open my $fh, '>>', 'file' or die $!; seek $fh, 0, 0 or die $ +!; print $fh 'baz';" >type file foo bar baz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Elegant Way of Inserting Text at the Start of the File
by ig (Vicar) on Nov 19, 2008 at 03:04 UTC | |
by ikegami (Patriarch) on Nov 19, 2008 at 04:24 UTC |