The $. variable holds the current line number. So you could something along
the lines of:
open TOMYFILE, "filename" or die $!;
&insert_at_line(*TOMYFILE, int); #int = what line you want to replace
######################################
sub insert_at_line {
my $linetoinsert = 'somemessage';
my ($filehandle) = @_;
while (<$filehandle>) {
next until $. == $_[1];
s/$_/$linetoinsert/; #or $_ .= $linetoinsert, etc. depends what u
want
}
}
It's not tested, but maybe it helps you think in a right direction? Also
since it is in a sub it is very easy to change what line you are interested in
in future calls.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]