in reply to insert into beginning of file

Use Tie::File.

Abigail

Replies are listed 'Best First'.
Re: Re: insert into beginning of file
by broquaint (Abbot) on Jul 22, 2002 at 13:56 UTC
    Supplementary to Abigail-II's advice here's example code of how you might insert a line into the beginning of a file using Tie::File
    use strict; use Tie::File; tie(my @fl, 'Tie::File', 'somefile.txt') or die("ack - $!"); unshift @fl, 'a line of text here'; untie @fl;
    If you're not doing line-based insertion into your file then your best choice is to open a new file and write to that.
    HTH

    _________
    broquaint

      When using Tie::File, I get the following error: Can't locate Tie/File.pm Is this because I don't have the latest version of Perl?