Anish Kumar K. wrote:
Hi
Hello,
I wanted to append some line in between a text file. So what I tried is
with the seek command I tried moving the pointer and then do appeding,
but for some reason it was not getting appended.
I know there are ways to make this task possible. I am afraid abot the
memory consumption so I haven;t used it.
Say I have a text file
Java
Oracle
Visual basic
I wanted to insert PERL after Oracle...So now the file should be
Java
Oracle
PERL
Visual basic
I did with array. ie first copying the file into array and then doing.
is there any alternate way
As explained in the FAQ:
perldoc -q "insert a line in the middle of a file"
use Tie::File;
tie my @array, 'Tie::File', 'filename' or die "Cannot open 'filename' $!";
splice @array, 2, 0, 'Perl';
untie @array;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>