use strict; open FILE, "fichero.txt"; my @lines = ; close FILE; my @newlines = ("First\n", "Second\n"); splice @lines,-30,0,@newlines; print @lines;