my $file = '/home/yanni/scripts/testfiles/list_names'; open my $NAMES, '+>>', $file || die "What the hell? Can't open file $!\n"; while (<$NAMES>) { if ($.== 3) {print "\nSimon\n";} } close ($NAMES);