in reply to need help:insert a line in a textfile

And an alternative for a test on $. for each line of the file:
$ perl -pwle 'BEGIN {print "First Line!"}' your_file

Or even

$ perl -Mstrict='}, print +("First Line"), qw {' -pwle1 your_file

Abigail

Replies are listed 'Best First'.
Re: Re: need help:insert a line in a textfile
by jmcnamara (Monsignor) on Sep 11, 2003 at 13:32 UTC

    Not testing $. is more efficient but it is worth pointing out that this doesn't work with -i.

    --
    John.