use Tie::File; my @records; tie @records, 'Tie::File', "pile_out.txt"; # file containing data $in_file = "fake_vals.fem"; # specific line number in the output file. The data from the input # file should be written at this line. $seed_line = 10; open(IN,"$in_file") or die("cannot open the log file for reading\n"); # NODE is the string to be matched with, in the data from the # input file while(){######to read the input file $records[$seed_line] = "$_" if($_=~/\bNODE\b/i); $seed_line++; } close(IN);